Package org.jgroups.blocks
Class BasicConnectionTable
- java.lang.Object
-
- org.jgroups.blocks.BasicConnectionTable
-
- Direct Known Subclasses:
ConnectionTable
,ConnectionTableNIO
public abstract class BasicConnectionTable extends java.lang.Object
Shared class for TCP connection tables.- Author:
- Scott Marlow, Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BasicConnectionTable.ConnectionListener
Used to be notified about connection establishment and teardown.static interface
BasicConnectionTable.Receiver
Used for message reception.
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
log
protected PortsManager
pm
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicConnectionTable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnectionListener(BasicConnectionTable.ConnectionListener l)
int
getLinger()
Address
getLocalAddress()
static int
getNumberOfConnectionCreations()
int
getNumConnections()
int
getPeerAddressReadTimeout()
int
getReceiveBufferSize()
int
getSendBufferSize()
int
getSendQueueSize()
int
getSocketConnectionTimeout()
boolean
getTcpNodelay()
ThreadFactory
getThreadFactory()
boolean
getUseSendQueues()
void
receive(Address sender, byte[] data, int offset, int length)
Calls the receiver callback.void
removeConnection(Address addr)
Removeaddr
from connection table.void
removeConnectionListener(BasicConnectionTable.ConnectionListener l)
void
retainAll(java.util.Collection<Address> current_mbrs)
Removes all connections from ConnectionTable which are not in current_mbrsvoid
send(Address dest, byte[] data, int offset, int length)
void
setLinger(int linger)
void
setPeerAddressReadTimeout(int peer_addr_read_timeout)
void
setReceiveBufferSize(int recv_buf_size)
void
setReceiver(BasicConnectionTable.Receiver r)
void
setSendBufferSize(int send_buf_size)
void
setSendQueueSize(int send_queue_size)
void
setSocketConnectionTimeout(int sock_conn_timeout)
void
setTcpNodelay(boolean tcp_nodelay)
void
setThreadFactory(ThreadFactory factory)
void
setUseSendQueues(boolean flag)
void
start()
void
stop()
java.lang.String
toString()
-
-
-
Field Detail
-
log
protected final org.apache.commons.logging.Log log
-
pm
protected PortsManager pm
-
-
Method Detail
-
setReceiver
public final void setReceiver(BasicConnectionTable.Receiver r)
-
addConnectionListener
public void addConnectionListener(BasicConnectionTable.ConnectionListener l)
-
removeConnectionListener
public void removeConnectionListener(BasicConnectionTable.ConnectionListener l)
-
getLocalAddress
public Address getLocalAddress()
-
getSendBufferSize
public int getSendBufferSize()
-
setSendBufferSize
public void setSendBufferSize(int send_buf_size)
-
getReceiveBufferSize
public int getReceiveBufferSize()
-
setReceiveBufferSize
public void setReceiveBufferSize(int recv_buf_size)
-
getSocketConnectionTimeout
public int getSocketConnectionTimeout()
-
setSocketConnectionTimeout
public void setSocketConnectionTimeout(int sock_conn_timeout)
-
getPeerAddressReadTimeout
public int getPeerAddressReadTimeout()
-
setPeerAddressReadTimeout
public void setPeerAddressReadTimeout(int peer_addr_read_timeout)
-
getNumConnections
public int getNumConnections()
-
getNumberOfConnectionCreations
public static int getNumberOfConnectionCreations()
-
getTcpNodelay
public boolean getTcpNodelay()
-
setTcpNodelay
public void setTcpNodelay(boolean tcp_nodelay)
-
getLinger
public int getLinger()
-
setLinger
public void setLinger(int linger)
-
setThreadFactory
public void setThreadFactory(ThreadFactory factory)
-
getThreadFactory
public ThreadFactory getThreadFactory()
-
getUseSendQueues
public boolean getUseSendQueues()
-
setUseSendQueues
public void setUseSendQueues(boolean flag)
-
getSendQueueSize
public int getSendQueueSize()
-
setSendQueueSize
public void setSendQueueSize(int send_queue_size)
-
start
public void start() throws java.lang.Exception
- Throws:
java.lang.Exception
-
stop
public void stop()
-
removeConnection
public void removeConnection(Address addr)
Removeaddr
from connection table. This is typically triggered when a member is suspected.
-
receive
public void receive(Address sender, byte[] data, int offset, int length)
Calls the receiver callback. We do not serialize access to this method, and it may be called concurrently by several Connection handler threads. Therefore the receiver needs to be reentrant.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
send
public void send(Address dest, byte[] data, int offset, int length) throws java.lang.Exception
- Throws:
java.lang.Exception
-
retainAll
public void retainAll(java.util.Collection<Address> current_mbrs)
Removes all connections from ConnectionTable which are not in current_mbrs- Parameters:
current_mbrs
-
-
-