org.jgroups.protocols
Class TCP
public
class
TCP
extends TP
implements ConnectionTable.Receiver
TCP based protocol. Creates a server socket, which gives us the local address of this group member. For
each accept() on the server socket, a new thread is created that listens on the socket.
For each outgoing message m, if m.dest is in the ougoing hashtable, the associated socket will be reused
to send message, otherwise a new socket is created and put in the hashtable.
When a socket connection breaks or a member is removed from the group, the corresponding items in the
incoming and outgoing hashtables will be removed as well.
This functionality is in ConnectionTable, which isT used by TCP. TCP sends messages using ct.send() and
registers with the connection table to receive all incoming messages.
Author: Bela Ban
Method Summary |
InetAddress | getBindAddr() |
protected ConnectionTable | getConnectionTable(long reaperInterval, long connExpireTime, InetAddress bindAddress, InetAddress externalAddress, int startPort, int endPort) |
long | getConnExpireTime() |
int | getEndPort() |
String | getInfo() |
String | getName() |
int | getOpenConnections() |
long | getReaperInterval() |
int | getStartPort() |
protected void | handleDownEvent(Event evt) |
boolean | isLoopback() |
void | postUnmarshalling(Message msg, Address dest, Address src, boolean multicast) |
void | postUnmarshallingList(Message msg, Address dest, boolean multicast) |
String | printConnections() |
void | receive(Address sender, byte[] data, int offset, int length) ConnectionTable.Receiver interface |
void | sendToAllMembers(byte[] data, int offset, int length) |
void | sendToSingleMember(Address dest, byte[] data, int offset, int length) |
void | setBindAddr(InetAddress bind_addr) |
void | setConnExpireTime(long conn_expire_time) |
void | setEndPort(int end_port) |
void | setLoopback(boolean loopback) |
boolean | setProperties(Properties props) Setup the Protocol instance acording to the configuration string |
void | setReaperInterval(long reaper_interval) |
void | setStartPort(int start_port) |
void | start() |
void | stop() |
public TCP()
public InetAddress getBindAddr()
protected
ConnectionTable getConnectionTable(long reaperInterval, long connExpireTime, InetAddress bindAddress, InetAddress externalAddress, int startPort, int endPort)
Parameters: reaperInterval connExpireTime bindAddress startPort
Returns: ConnectionTable
Sub classes overrides this method to initialize a different version of
ConnectionTable.
Throws: Exception
public long getConnExpireTime()
public int getEndPort()
public String getInfo()
public String getName()
public int getOpenConnections()
public long getReaperInterval()
public int getStartPort()
protected void handleDownEvent(
Event evt)
public boolean isLoopback()
public void postUnmarshallingList(
Message msg,
Address dest, boolean multicast)
public String printConnections()
public void receive(
Address sender, byte[] data, int offset, int length)
ConnectionTable.Receiver interface
public void sendToAllMembers(byte[] data, int offset, int length)
public void sendToSingleMember(
Address dest, byte[] data, int offset, int length)
public void setBindAddr(InetAddress bind_addr)
public void setConnExpireTime(long conn_expire_time)
public void setEndPort(int end_port)
public void setLoopback(boolean loopback)
public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
public void setReaperInterval(long reaper_interval)
public void setStartPort(int start_port)
public void start()
public void stop()
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.