Source Code Cross Referenced for AbstractSender.java in  » Sevlet-Container » apache-tomcat-6.0.14 » org » apache » catalina » tribes » transport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » apache tomcat 6.0.14 » org.apache.catalina.tribes.transport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.catalina.tribes.transport;
019:
020:        import java.io.IOException;
021:        import java.net.InetAddress;
022:        import java.net.UnknownHostException;
023:
024:        import org.apache.catalina.tribes.Member;
025:
026:        /**
027:         * <p>Title: </p>
028:         *
029:         * <p>Description: </p>
030:         *
031:         * <p>Company: </p>
032:         *
033:         * @author not attributable
034:         * @version 1.0
035:         */
036:        public abstract class AbstractSender implements  DataSender {
037:
038:            private boolean connected = false;
039:            private int rxBufSize = 25188;
040:            private int txBufSize = 43800;
041:            private boolean directBuffer = false;
042:            private int keepAliveCount = -1;
043:            private int requestCount = 0;
044:            private long connectTime;
045:            private long keepAliveTime = -1;
046:            private long timeout = 3000;
047:            private Member destination;
048:            private InetAddress address;
049:            private int port;
050:            private int maxRetryAttempts = 1;//1 resends
051:            private int attempt;
052:            private boolean tcpNoDelay = true;
053:            private boolean soKeepAlive = false;
054:            private boolean ooBInline = true;
055:            private boolean soReuseAddress = true;
056:            private boolean soLingerOn = false;
057:            private int soLingerTime = 3;
058:            private int soTrafficClass = 0x04 | 0x08 | 0x010;
059:            private boolean throwOnFailedAck = true;
060:
061:            /**
062:             * transfers sender properties from one sender to another
063:             * @param from AbstractSender
064:             * @param to AbstractSender
065:             */
066:            public static void transferProperties(AbstractSender from,
067:                    AbstractSender to) {
068:                to.rxBufSize = from.rxBufSize;
069:                to.txBufSize = from.txBufSize;
070:                to.directBuffer = from.directBuffer;
071:                to.keepAliveCount = from.keepAliveCount;
072:                to.keepAliveTime = from.keepAliveTime;
073:                to.timeout = from.timeout;
074:                to.destination = from.destination;
075:                to.address = from.address;
076:                to.port = from.port;
077:                to.maxRetryAttempts = from.maxRetryAttempts;
078:                to.tcpNoDelay = from.tcpNoDelay;
079:                to.soKeepAlive = from.soKeepAlive;
080:                to.ooBInline = from.ooBInline;
081:                to.soReuseAddress = from.soReuseAddress;
082:                to.soLingerOn = from.soLingerOn;
083:                to.soLingerTime = from.soLingerTime;
084:                to.soTrafficClass = from.soTrafficClass;
085:                to.throwOnFailedAck = from.throwOnFailedAck;
086:            }
087:
088:            public AbstractSender() {
089:
090:            }
091:
092:            /**
093:             * connect
094:             *
095:             * @throws IOException
096:             * @todo Implement this org.apache.catalina.tribes.transport.DataSender method
097:             */
098:            public abstract void connect() throws IOException;
099:
100:            /**
101:             * disconnect
102:             *
103:             * @todo Implement this org.apache.catalina.tribes.transport.DataSender method
104:             */
105:            public abstract void disconnect();
106:
107:            /**
108:             * keepalive
109:             *
110:             * @return boolean
111:             * @todo Implement this org.apache.catalina.tribes.transport.DataSender method
112:             */
113:            public boolean keepalive() {
114:                boolean disconnect = false;
115:                if (keepAliveCount >= 0 && requestCount > keepAliveCount)
116:                    disconnect = true;
117:                else if (keepAliveTime >= 0
118:                        && (System.currentTimeMillis() - connectTime) > keepAliveTime)
119:                    disconnect = true;
120:                if (disconnect)
121:                    disconnect();
122:                return disconnect;
123:            }
124:
125:            protected void setConnected(boolean connected) {
126:                this .connected = connected;
127:            }
128:
129:            public boolean isConnected() {
130:                return connected;
131:            }
132:
133:            public long getConnectTime() {
134:                return connectTime;
135:            }
136:
137:            public Member getDestination() {
138:                return destination;
139:            }
140:
141:            public int getKeepAliveCount() {
142:                return keepAliveCount;
143:            }
144:
145:            public long getKeepAliveTime() {
146:                return keepAliveTime;
147:            }
148:
149:            public int getRequestCount() {
150:                return requestCount;
151:            }
152:
153:            public int getRxBufSize() {
154:                return rxBufSize;
155:            }
156:
157:            public long getTimeout() {
158:                return timeout;
159:            }
160:
161:            public int getTxBufSize() {
162:                return txBufSize;
163:            }
164:
165:            public InetAddress getAddress() {
166:                return address;
167:            }
168:
169:            public int getPort() {
170:                return port;
171:            }
172:
173:            public int getMaxRetryAttempts() {
174:                return maxRetryAttempts;
175:            }
176:
177:            public void setDirect(boolean direct) {
178:                setDirectBuffer(direct);
179:            }
180:
181:            public void setDirectBuffer(boolean directBuffer) {
182:                this .directBuffer = directBuffer;
183:            }
184:
185:            public boolean getDirect() {
186:                return getDirectBuffer();
187:            }
188:
189:            public boolean getDirectBuffer() {
190:                return this .directBuffer;
191:            }
192:
193:            public int getAttempt() {
194:                return attempt;
195:            }
196:
197:            public boolean getTcpNoDelay() {
198:                return tcpNoDelay;
199:            }
200:
201:            public boolean getSoKeepAlive() {
202:                return soKeepAlive;
203:            }
204:
205:            public boolean getOoBInline() {
206:                return ooBInline;
207:            }
208:
209:            public boolean getSoReuseAddress() {
210:                return soReuseAddress;
211:            }
212:
213:            public boolean getSoLingerOn() {
214:                return soLingerOn;
215:            }
216:
217:            public int getSoLingerTime() {
218:                return soLingerTime;
219:            }
220:
221:            public int getSoTrafficClass() {
222:                return soTrafficClass;
223:            }
224:
225:            public boolean getThrowOnFailedAck() {
226:                return throwOnFailedAck;
227:            }
228:
229:            public void setKeepAliveCount(int keepAliveCount) {
230:                this .keepAliveCount = keepAliveCount;
231:            }
232:
233:            public void setKeepAliveTime(long keepAliveTime) {
234:                this .keepAliveTime = keepAliveTime;
235:            }
236:
237:            public void setRequestCount(int requestCount) {
238:                this .requestCount = requestCount;
239:            }
240:
241:            public void setRxBufSize(int rxBufSize) {
242:                this .rxBufSize = rxBufSize;
243:            }
244:
245:            public void setTimeout(long timeout) {
246:                this .timeout = timeout;
247:            }
248:
249:            public void setTxBufSize(int txBufSize) {
250:                this .txBufSize = txBufSize;
251:            }
252:
253:            public void setConnectTime(long connectTime) {
254:                this .connectTime = connectTime;
255:            }
256:
257:            public void setMaxRetryAttempts(int maxRetryAttempts) {
258:                this .maxRetryAttempts = maxRetryAttempts;
259:            }
260:
261:            public void setAttempt(int attempt) {
262:                this .attempt = attempt;
263:            }
264:
265:            public void setTcpNoDelay(boolean tcpNoDelay) {
266:                this .tcpNoDelay = tcpNoDelay;
267:            }
268:
269:            public void setSoKeepAlive(boolean soKeepAlive) {
270:                this .soKeepAlive = soKeepAlive;
271:            }
272:
273:            public void setOoBInline(boolean ooBInline) {
274:                this .ooBInline = ooBInline;
275:            }
276:
277:            public void setSoReuseAddress(boolean soReuseAddress) {
278:                this .soReuseAddress = soReuseAddress;
279:            }
280:
281:            public void setSoLingerOn(boolean soLingerOn) {
282:                this .soLingerOn = soLingerOn;
283:            }
284:
285:            public void setSoLingerTime(int soLingerTime) {
286:                this .soLingerTime = soLingerTime;
287:            }
288:
289:            public void setSoTrafficClass(int soTrafficClass) {
290:                this .soTrafficClass = soTrafficClass;
291:            }
292:
293:            public void setThrowOnFailedAck(boolean throwOnFailedAck) {
294:                this .throwOnFailedAck = throwOnFailedAck;
295:            }
296:
297:            public void setDestination(Member destination)
298:                    throws UnknownHostException {
299:                this .destination = destination;
300:                this .address = InetAddress.getByAddress(destination.getHost());
301:                this .port = destination.getPort();
302:
303:            }
304:
305:            public void setPort(int port) {
306:                this .port = port;
307:            }
308:
309:            public void setAddress(InetAddress address) {
310:                this.address = address;
311:            }
312:
313:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.