org.jgroups.blocks

## Class TCPConnectionMap

- java.lang.Object
- - org.jgroups.blocks.TCPConnectionMap

    public class TCPConnectionMap
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`static interface` `TCPConnectionMap.Receiver` Used for message reception.
`class` `TCPConnectionMap.TCPConnection`

### Field Summary

Fields
`protected SocketFactory` `socket_factory`

### Constructor Summary

Constructors
Constructor and Description
`TCPConnectionMap(java.lang.String service_name, ThreadFactory f, SocketFactory socket_factory, TCPConnectionMap.Receiver r, java.net.InetAddress bind_addr, java.net.InetAddress external_addr, int srv_port, int max_port)`
`TCPConnectionMap(java.lang.String service_name, ThreadFactory f, SocketFactory socket_factory, TCPConnectionMap.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)`
`TCPConnectionMap(java.lang.String service_name, ThreadFactory f, TCPConnectionMap.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)`

### Method Summary

Methods
`void` `addConnectionMapListener(AbstractConnectionMap.ConnectionMapListener<TCPConnectionMap.TCPConnection> l)`
`boolean` `connectionEstablishedTo(Address addr)`
`long` `getConnectionExpiryTimeout()`
`Address` `getLocalAddress()`
`int` `getNumConnections()`
`TCPConnectionMap.Receiver` `getReceiver()`
`int` `getSenderQueueSize()`
`SocketFactory` `getSocketFactory()`
`java.lang.String` `printConnections()`
`void` `receive(Address sender, byte[] data, int offset, int length)` Calls the receiver callback.
`void` `removeConnectionMapListener(AbstractConnectionMap.ConnectionMapListener<TCPConnectionMap.TCPConnection> l)`
`void` `retainAll(java.util.Collection<Address> members)`
`void` `send(Address dest, byte[] data, int offset, int length)`
`void` `setLinger(int linger)`
`void` `setReceiveBufferSize(int recv_buf_size)`
`void` `setReceiver(TCPConnectionMap.Receiver receiver)`
`void` `setSendBufferSize(int send_buf_size)`
`void` `setSendQueueSize(int send_queue_size)`
`void` `setSocketConnectionTimeout(int sock_conn_timeout)`
`void` `setSocketFactory(SocketFactory socket_factory)`
`void` `setTcpNodelay(boolean tcp_nodelay)`
`void` `setUseSendQueues(boolean use_send_queues)`
`void` `start()`
`void` `stop()`
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### socket_factory

    protected SocketFactory socket_factory

### Constructor Detail

#### TCPConnectionMap

    public TCPConnectionMap(java.lang.String service_name,
                    ThreadFactory f,
                    SocketFactory socket_factory,
                    TCPConnectionMap.Receiver r,
                    java.net.InetAddress bind_addr,
                    java.net.InetAddress external_addr,
                    int srv_port,
                    int max_port)
                     throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### TCPConnectionMap

    public TCPConnectionMap(java.lang.String service_name,
                    ThreadFactory f,
                    TCPConnectionMap.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

Throws:
  `java.lang.Exception`

#### TCPConnectionMap

    public TCPConnectionMap(java.lang.String service_name,
                    ThreadFactory f,
                    SocketFactory socket_factory,
                    TCPConnectionMap.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

Throws:
  `java.lang.Exception`

### Method Detail

#### getLocalAddress

    public Address getLocalAddress()

#### getReceiver

    public TCPConnectionMap.Receiver getReceiver()

#### setReceiver

    public void setReceiver(TCPConnectionMap.Receiver receiver)

#### getSocketFactory

    public SocketFactory getSocketFactory()

#### setSocketFactory

    public void setSocketFactory(SocketFactory socket_factory)

#### addConnectionMapListener

    public void addConnectionMapListener(AbstractConnectionMap.ConnectionMapListener<TCPConnectionMap.TCPConnection> l)

#### removeConnectionMapListener

    public void removeConnectionMapListener(AbstractConnectionMap.ConnectionMapListener<TCPConnectionMap.TCPConnection> l)

#### 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.

#### send

    public void send(Address dest,
            byte[] data,
            int offset,
            int length)
              throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### start

    public void start()
               throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### stop

    public void stop()

#### setReceiveBufferSize

    public void setReceiveBufferSize(int recv_buf_size)

#### setSocketConnectionTimeout

    public void setSocketConnectionTimeout(int sock_conn_timeout)

#### setSendBufferSize

    public void setSendBufferSize(int send_buf_size)

#### setLinger

    public void setLinger(int linger)

#### setTcpNodelay

    public void setTcpNodelay(boolean tcp_nodelay)

#### setSendQueueSize

    public void setSendQueueSize(int send_queue_size)

#### setUseSendQueues

    public void setUseSendQueues(boolean use_send_queues)

#### getNumConnections

    public int getNumConnections()

#### connectionEstablishedTo

    public boolean connectionEstablishedTo(Address addr)

#### printConnections

    public java.lang.String printConnections()

#### retainAll

    public void retainAll(java.util.Collection<Address> members)

#### getConnectionExpiryTimeout

    public long getConnectionExpiryTimeout()

#### getSenderQueueSize

    public int getSenderQueueSize()

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`