Java Doc for ConnectionTable.java in  » Net » JGroups-2.4.1-sp3 » org » jgroups » blocks » 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 » Net » JGroups 2.4.1 sp3 » org.jgroups.blocks 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jgroups.blocks.BasicConnectionTable
      org.jgroups.blocks.ConnectionTable

All known Subclasses:   org.jgroups.tests.ConnectionTableDemo,  org.jgroups.protocols.TCP,
ConnectionTable
public class ConnectionTable extends BasicConnectionTable implements Runnable(Code)
Manages incoming and outgoing TCP connections. For each outgoing message to destination P, if there is not yet a connection for P, one will be created. Subsequent outgoing messages will use this connection. For incoming messages, one server socket is created at startup. For each new incoming client connecting, a new thread from a thread pool is allocated and listens for incoming messages until the socket is closed by the peer.
Sockets/threads with no activity will be killed after some time.

Incoming messages from any of the sockets can be received by setting the message listener.
author:
   Bela Ban




Constructor Summary
public  ConnectionTable(int srv_port)
     Regular ConnectionTable without expiration of idle connections
Parameters:
  srv_port - The port on which the server will listen.
public  ConnectionTable(InetAddress bind_addr, int srv_port)
    
public  ConnectionTable(int srv_port, long reaper_interval, long conn_expire_time)
     ConnectionTable including a connection reaper.
public  ConnectionTable(Receiver r, InetAddress bind_addr, InetAddress external_addr, int srv_port, int max_port)
     Create a ConnectionTable
Parameters:
  r - A reference to a receiver of all messages received by this class.
public  ConnectionTable(Receiver r, InetAddress bind_addr, InetAddress external_addr, int srv_port, int max_port, long reaper_interval, long conn_expire_time)
     ConnectionTable including a connection reaper.

Method Summary
protected  ServerSocketcreateServerSocket(int start_port, int end_port)
     Finds first available port starting at start_port and returns server socket. Will not bind to port >end_port.
 ConnectiongetConnection(Address dest)
    
protected  voidinit()
    
public  voidrun()
     Acceptor thread.
final public  voidstart()
    
public  voidstop()
    


Constructor Detail
ConnectionTable
public ConnectionTable(int srv_port) throws Exception(Code)
Regular ConnectionTable without expiration of idle connections
Parameters:
  srv_port - The port on which the server will listen. If this port is reserved, the nextfree port will be taken (incrementing srv_port).



ConnectionTable
public ConnectionTable(InetAddress bind_addr, int srv_port) throws Exception(Code)



ConnectionTable
public ConnectionTable(int srv_port, long reaper_interval, long conn_expire_time) throws Exception(Code)
ConnectionTable including a connection reaper. Connections that have been idle for more than conn_expire_time milliseconds will be closed and removed from the connection table. On next access they will be re-created.
Parameters:
  srv_port - The port on which the server will listen
Parameters:
  reaper_interval - Number of milliseconds to wait for reaper between attepts to reap idle connections
Parameters:
  conn_expire_time - Number of milliseconds a connection can be idle (no traffic sent or received untilit will be reaped



ConnectionTable
public ConnectionTable(Receiver r, InetAddress bind_addr, InetAddress external_addr, int srv_port, int max_port) throws Exception(Code)
Create a ConnectionTable
Parameters:
  r - A reference to a receiver of all messages received by this class. Method receive()will be called.
Parameters:
  bind_addr - The host name or IP address of the interface to which the server socket will bind.This is interesting only in multi-homed systems. If bind_addr is null, theserver socket will bind to the first available interface (e.g. /dev/hme0 onSolaris or /dev/eth0 on Linux systems).
Parameters:
  external_addr - The address which will be broadcast to the group (the externally visible addresswhich this host should be contacted on). If external_addr is null, it will default tothe same address that the server socket is bound to.
Parameters:
  srv_port - The port to which the server socket will bind to. If this port is reserved, the nextfree port will be taken (incrementing srv_port).
Parameters:
  max_port - The largest port number that the server socket will be bound to. If max_port < srv_portthen there is no limit.



ConnectionTable
public ConnectionTable(Receiver r, InetAddress bind_addr, InetAddress external_addr, int srv_port, int max_port, long reaper_interval, long conn_expire_time) throws Exception(Code)
ConnectionTable including a connection reaper. Connections that have been idle for more than conn_expire_time milliseconds will be closed and removed from the connection table. On next access they will be re-created.
Parameters:
  r - The Receiver
Parameters:
  bind_addr - The host name or IP address of the interface to which the server socket will bind.This is interesting only in multi-homed systems. If bind_addr is null, theserver socket will bind to the first available interface (e.g. /dev/hme0 onSolaris or /dev/eth0 on Linux systems).
Parameters:
  external_addr - The address which will be broadcast to the group (the externally visible addresswhich this host should be contacted on). If external_addr is null, it will default tothe same address that the server socket is bound to.
Parameters:
  srv_port - The port to which the server socket will bind to. If this port is reserved, the nextfree port will be taken (incrementing srv_port).
Parameters:
  max_port - The largest port number that the server socket will be bound to. If max_port < srv_portthen there is no limit.
Parameters:
  reaper_interval - Number of milliseconds to wait for reaper between attepts to reap idle connections
Parameters:
  conn_expire_time - Number of milliseconds a connection can be idle (no traffic sent or received untilit will be reaped




Method Detail
createServerSocket
protected ServerSocket createServerSocket(int start_port, int end_port) throws Exception(Code)
Finds first available port starting at start_port and returns server socket. Will not bind to port >end_port. Sets srv_port



getConnection
Connection getConnection(Address dest) throws Exception(Code)
Try to obtain correct Connection (or create one if not yet existent)



init
protected void init() throws Exception(Code)



run
public void run()(Code)
Acceptor thread. Continuously accept new connections. Create a new thread for each new connection and put it in conns. When the thread should stop, it is interrupted by the thread creator.



start
final public void start() throws Exception(Code)



stop
public void stop()(Code)
Closes all open sockets, the server socket and all threads waiting for incoming messages



Fields inherited from org.jgroups.blocks.BasicConnectionTable
final static long MAX_JOIN_TIMEOUT(Code)(Java Doc)
Thread acceptor(Code)(Java Doc)
final static int backlog(Code)(Java Doc)
InetAddress bind_addr(Code)(Java Doc)
long conn_expire_time(Code)(Java Doc)
final Vector conn_listeners(Code)(Java Doc)
final HashMap conns(Code)(Java Doc)
final byte[] cookie(Code)(Java Doc)
InetAddress external_addr(Code)(Java Doc)
int linger(Code)(Java Doc)
Address local_addr(Code)(Java Doc)
final protected Log log(Code)(Java Doc)
int max_port(Code)(Java Doc)
Reaper reaper(Code)(Java Doc)
long reaper_interval(Code)(Java Doc)
Receiver receiver(Code)(Java Doc)
int recv_buf_size(Code)(Java Doc)
final Object recv_mutex(Code)(Java Doc)
boolean reuse_addr(Code)(Java Doc)
boolean running(Code)(Java Doc)
int send_buf_size(Code)(Java Doc)
int sock_conn_timeout(Code)(Java Doc)
int srv_port(Code)(Java Doc)
ServerSocket srv_sock(Code)(Java Doc)
boolean tcp_nodelay(Code)(Java Doc)
ThreadGroup thread_group(Code)(Java Doc)
boolean use_reaper(Code)(Java Doc)
boolean use_send_queues(Code)(Java Doc)

Methods inherited from org.jgroups.blocks.BasicConnectionTable
void addConnection(Address peer, Connection c)(Code)(Java Doc)
public void addConnectionListener(ConnectionListener l)(Code)(Java Doc)
abstract Connection getConnection(Address dest) throws Exception(Code)(Java Doc)
public int getLinger()(Code)(Java Doc)
public Address getLocalAddress()(Code)(Java Doc)
public int getNumConnections()(Code)(Java Doc)
public int getReceiveBufferSize()(Code)(Java Doc)
public int getSendBufferSize()(Code)(Java Doc)
public int getSocketConnectionTimeout()(Code)(Java Doc)
public boolean getTcpNodelay()(Code)(Java Doc)
public boolean getUseSendQueues()(Code)(Java Doc)
void notifyConnectionClosed(Address peer)(Code)(Java Doc)
void notifyConnectionOpened(Address peer)(Code)(Java Doc)
public void receive(Address sender, byte[] data, int offset, int length)(Code)(Java Doc)
public void remove(Address addr)(Code)(Java Doc)
public void removeConnectionListener(ConnectionListener l)(Code)(Java Doc)
public void retainAll(Collection current_mbrs)(Code)(Java Doc)
public void send(Address dest, byte[] data, int offset, int length) throws Exception(Code)(Java Doc)
public void setLinger(int linger)(Code)(Java Doc)
public void setReceiveBufferSize(int recv_buf_size)(Code)(Java Doc)
final public void setReceiver(Receiver r)(Code)(Java Doc)
public void setSendBufferSize(int send_buf_size)(Code)(Java Doc)
public void setSocketConnectionTimeout(int sock_conn_timeout)(Code)(Java Doc)
public void setTcpNodelay(boolean tcp_nodelay)(Code)(Java Doc)
public void setUseSendQueues(boolean flag)(Code)(Java Doc)
public void start() throws Exception(Code)(Java Doc)
public void stop()(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.