org.jgroups.blocks
Class ConnectionTable1_4
java.lang.Object
org.jgroups.blocks.ConnectionTable
org.jgroups.blocks.ConnectionTable1_4
- All Implemented Interfaces:
- java.lang.Runnable
- public class ConnectionTable1_4
- extends ConnectionTable
- implements java.lang.Runnable
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
Method Summary |
void |
run()
Acceptor thread. |
void |
stop()
Closes all open sockets, the server socket and all threads waiting for incoming messages |
Methods inherited from class org.jgroups.blocks.ConnectionTable |
addConnectionListener, getLocalAddress, getReceiveBufferSize, getSendBufferSize, receive, remove, removeConnectionListener, send, setReceiveBufferSize, setReceiver, setSendBufferSize, start, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ConnectionTable1_4
public ConnectionTable1_4(int srv_port)
throws java.lang.Exception
- Parameters:
srv_port
-
- Throws:
java.lang.Exception
ConnectionTable1_4
public ConnectionTable1_4(int srv_port,
long reaper_interval,
long conn_expire_time)
throws java.lang.Exception
- Parameters:
srv_port
- reaper_interval
- conn_expire_time
-
- Throws:
java.lang.Exception
ConnectionTable1_4
public ConnectionTable1_4(ConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
int srv_port)
throws java.lang.Exception
- Parameters:
r
- bind_addr
- srv_port
-
- Throws:
java.lang.Exception
ConnectionTable1_4
public ConnectionTable1_4(ConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
int srv_port,
long reaper_interval,
long conn_expire_time)
throws java.lang.Exception
- Parameters:
r
- bind_addr
- srv_port
- reaper_interval
- conn_expire_time
-
- Throws:
java.lang.Exception
stop
public void stop()
- Closes all open sockets, the server socket and all threads waiting for incoming messages
- Overrides:
stop
in class ConnectionTable
run
public void run()
- 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.
- Specified by:
run
in interface java.lang.Runnable
- Overrides:
run
in class ConnectionTable
Copyright ? 2001,2002 www.jgroups.com . All Rights Reserved.