public class ConnectionTable extends BasicConnectionTable implements java.lang.Runnable
Incoming messages from any of the sockets can be received by setting the message listener.
BasicConnectionTable.ConnectionListener, BasicConnectionTable.Receiver
log, pm
Constructor and Description |
---|
ConnectionTable(BasicConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
java.net.InetAddress external_addr,
int srv_port,
int max_port) |
ConnectionTable(BasicConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
java.net.InetAddress external_addr,
int srv_port,
int max_port,
long reaper_interval,
long conn_expire_time) |
ConnectionTable(BasicConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
java.net.InetAddress external_addr,
int srv_port,
int max_port,
long reaper_interval,
long conn_expire_time,
PortsManager pm)
ConnectionTable including a connection reaper.
|
ConnectionTable(BasicConnectionTable.Receiver r,
java.net.InetAddress bind_addr,
java.net.InetAddress external_addr,
int srv_port,
int max_port,
PortsManager pm)
Create a ConnectionTable
|
ConnectionTable(java.net.InetAddress bind_addr,
int srv_port) |
ConnectionTable(int srv_port)
Regular ConnectionTable without expiration of idle connections
|
ConnectionTable(int srv_port,
long reaper_interval,
long conn_expire_time)
ConnectionTable including a connection reaper.
|
Modifier and Type | Method and Description |
---|---|
protected java.net.ServerSocket |
createServerSocket(int start_port,
int end_port)
Finds first available port starting at start_port and returns server socket.
|
protected void |
init() |
void |
run()
Acceptor thread.
|
void |
start() |
addConnectionListener, getLinger, getLocalAddress, getNumberOfConnectionCreations, getNumConnections, getPeerAddressReadTimeout, getReceiveBufferSize, getSendBufferSize, getSendQueueSize, getSocketConnectionTimeout, getTcpNodelay, getThreadFactory, getUseSendQueues, receive, removeConnection, removeConnectionListener, retainAll, send, setLinger, setPeerAddressReadTimeout, setReceiveBufferSize, setReceiver, setSendBufferSize, setSendQueueSize, setSocketConnectionTimeout, setTcpNodelay, setThreadFactory, setUseSendQueues, stop, toString
public ConnectionTable(int srv_port) throws java.lang.Exception
srv_port
- The port on which the server will listen. If this port is reserved, the next
free port will be taken (incrementing srv_port).java.lang.Exception
public ConnectionTable(java.net.InetAddress bind_addr, int srv_port) throws java.lang.Exception
java.lang.Exception
public ConnectionTable(int srv_port, long reaper_interval, long conn_expire_time) throws java.lang.Exception
srv_port
- The port on which the server will listenreaper_interval
- Number of milliseconds to wait for reaper between attepts to reap idle connectionsconn_expire_time
- Number of milliseconds a connection can be idle (no traffic sent or received until
it will be reapedjava.lang.Exception
public ConnectionTable(BasicConnectionTable.Receiver r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int srv_port, int max_port) throws java.lang.Exception
java.lang.Exception
public ConnectionTable(BasicConnectionTable.Receiver r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int srv_port, int max_port, PortsManager pm) throws java.lang.Exception
r
- A reference to a receiver of all messages received by this class. Method receive()
will be called.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, the
server socket will bind to the first available interface (e.g. /dev/hme0 on
Solaris or /dev/eth0 on Linux systems).external_addr
- The address which will be broadcast to the group (the externally visible address
which this host should be contacted on). If external_addr is null, it will default to
the same address that the server socket is bound to.srv_port
- The port to which the server socket will bind to. If this port is reserved, the next
free port will be taken (incrementing srv_port).max_port
- The largest port number that the server socket will be bound to. If max_port < srv_port
then there is no limit.java.lang.Exception
public ConnectionTable(BasicConnectionTable.Receiver r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int srv_port, int max_port, long reaper_interval, long conn_expire_time) throws java.lang.Exception
java.lang.Exception
public ConnectionTable(BasicConnectionTable.Receiver r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int srv_port, int max_port, long reaper_interval, long conn_expire_time, PortsManager pm) throws java.lang.Exception
r
- The Receiverbind_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, the
server socket will bind to the first available interface (e.g. /dev/hme0 on
Solaris or /dev/eth0 on Linux systems).external_addr
- The address which will be broadcast to the group (the externally visible address
which this host should be contacted on). If external_addr is null, it will default to
the same address that the server socket is bound to.srv_port
- The port to which the server socket will bind to. If this port is reserved, the next
free port will be taken (incrementing srv_port).max_port
- The largest port number that the server socket will be bound to. If max_port < srv_port
then there is no limit.reaper_interval
- Number of milliseconds to wait for reaper between attepts to reap idle connectionsconn_expire_time
- Number of milliseconds a connection can be idle (no traffic sent or received until
it will be reapedjava.lang.Exception
public final void start() throws java.lang.Exception
start
in class BasicConnectionTable
java.lang.Exception
protected void init() throws java.lang.Exception
java.lang.Exception
public void run()
run
in interface java.lang.Runnable
protected java.net.ServerSocket createServerSocket(int start_port, int end_port) throws java.lang.Exception
java.lang.Exception
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.