org.jgroups.blocks

Class ConnectionTable1_4

Implemented Interfaces:
Runnable

public class ConnectionTable1_4
extends ConnectionTable
implements 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

Nested Class Summary

Nested classes/interfaces inherited from class org.jgroups.blocks.ConnectionTable

ConnectionTable.ConnectionListener, ConnectionTable.Receiver

Field Summary

Fields inherited from class org.jgroups.blocks.ConnectionTable

log

Constructor Summary

ConnectionTable1_4(int srv_port)
ConnectionTable1_4(int srv_port, long reaper_interval, long conn_expire_time)
ConnectionTable1_4(ConnectionTable.Receiver r, InetAddress bind_addr, int srv_port)
ConnectionTable1_4(ConnectionTable.Receiver r, InetAddress bind_addr, int srv_port, long reaper_interval, long conn_expire_time)

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, run, send, setReceiveBufferSize, setReceiver, setSendBufferSize, start, stop, toString

Constructor Details

ConnectionTable1_4

public ConnectionTable1_4(int srv_port)
            throws Exception
Parameters:
srv_port -

ConnectionTable1_4

public ConnectionTable1_4(int srv_port,
                          long reaper_interval,
                          long conn_expire_time)
            throws Exception
Parameters:
srv_port -
reaper_interval -
conn_expire_time -

ConnectionTable1_4

public ConnectionTable1_4(ConnectionTable.Receiver r,
                          InetAddress bind_addr,
                          int srv_port)
            throws Exception
Parameters:
r -
bind_addr -
srv_port -

ConnectionTable1_4

public ConnectionTable1_4(ConnectionTable.Receiver r,
                          InetAddress bind_addr,
                          int srv_port,
                          long reaper_interval,
                          long conn_expire_time)
            throws Exception
Parameters:
r -
bind_addr -
srv_port -
reaper_interval -
conn_expire_time -

Method Details

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.
Overrides:
run in interface ConnectionTable

stop

public void stop()
Closes all open sockets, the server socket and all threads waiting for incoming messages
Overrides:
stop in interface ConnectionTable

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.