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.
getBindAddr
public InetAddress getBindAddr()
getConnExpireTime
public long getConnExpireTime()
getConnectionTable
protected ConnectionTable getConnectionTable(long reaperInterval,
long connExpireTime,
InetAddress bindAddress,
InetAddress externalAddress,
int startPort,
int endPort)
throws Exception
reaperInterval
- connExpireTime
- bindAddress
- startPort
-
- ConnectionTable
Sub classes overrides this method to initialize a different version of
ConnectionTable.
getEndPort
public int getEndPort()
getInfo
public String getInfo()
- getInfo in interface TP
getOpenConnections
public int getOpenConnections()
getReaperInterval
public long getReaperInterval()
getStartPort
public int getStartPort()
isLoopback
public boolean isLoopback()
- isLoopback in interface TP
printConnections
public String printConnections()
sendToAllMembers
public void sendToAllMembers(byte[] data,
int offset,
int length)
throws Exception
- sendToAllMembers in interface TP
sendToSingleMember
public void sendToSingleMember(Address dest,
byte[] data,
int offset,
int length)
throws Exception
- sendToSingleMember in interface TP
setBindAddr
public void setBindAddr(InetAddress bind_addr)
setConnExpireTime
public void setConnExpireTime(long conn_expire_time)
setEndPort
public void setEndPort(int end_port)
setLoopback
public void setLoopback(boolean loopback)
- setLoopback in interface TP
setProperties
public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
- setProperties in interface TP
setReaperInterval
public void setReaperInterval(long reaper_interval)
setStartPort
public void setStartPort(int start_port)
start
public void start()
throws Exception
- start in interface TP
stop
public void stop()
- stop in interface TP