org.jgroups.blocks
Class TCPConnectionMap

java.lang.Object
  extended by org.jgroups.blocks.TCPConnectionMap

public class TCPConnectionMap
extends java.lang.Object


Nested Class Summary
protected  class TCPConnectionMap.ConnectionAcceptor
           
protected  class TCPConnectionMap.Mapper
           
static interface TCPConnectionMap.Receiver
          Used for message reception.
 class TCPConnectionMap.TCPConnection
           
 
Field Summary
protected  java.lang.Thread acceptor
           
protected  java.net.InetAddress bind_addr
           
protected  java.net.InetAddress client_bind_addr
           
protected  int client_bind_port
           
protected  long conn_expire_time
           
protected  boolean defer_client_binding
           
protected  int linger
           
protected  Address local_addr
           
protected  Log log
           
protected  TCPConnectionMap.Mapper mapper
           
protected  TCPConnectionMap.Receiver receiver
           
protected  int recv_buf_size
           
protected  java.util.concurrent.atomic.AtomicBoolean running
           
protected  int send_buf_size
           
protected  int send_queue_size
           
protected  int sock_conn_timeout
           
protected  SocketFactory socket_factory
           
protected  java.net.ServerSocket srv_sock
           
protected  boolean tcp_nodelay
           
protected  boolean use_send_queues
           
 
Constructor Summary
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 external_port, 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 external_port, 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 external_port, int srv_port, int max_port, long reaper_interval, long conn_expire_time)
           
 
Method Summary
 void addConnectionMapListener(AbstractConnectionMap.ConnectionMapListener<TCPConnectionMap.TCPConnection> l)
           
 java.net.InetAddress clientBindAddress()
           
 TCPConnectionMap clientBindAddress(java.net.InetAddress addr)
           
 int clientBindPort()
           
 TCPConnectionMap clientBindPort(int port)
           
 boolean connectionEstablishedTo(Address addr)
           
 boolean deferClientBinding()
           
 TCPConnectionMap deferClientBinding(boolean defer)
           
 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 factory)
           
protected  void setSocketParameters(java.net.Socket client_sock)
           
 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

mapper

protected final TCPConnectionMap.Mapper mapper

bind_addr

protected final java.net.InetAddress bind_addr

client_bind_addr

protected java.net.InetAddress client_bind_addr

client_bind_port

protected int client_bind_port

defer_client_binding

protected boolean defer_client_binding

local_addr

protected final Address local_addr

srv_sock

protected final java.net.ServerSocket srv_sock

receiver

protected TCPConnectionMap.Receiver receiver

conn_expire_time

protected final long conn_expire_time

log

protected final Log log

recv_buf_size

protected int recv_buf_size

send_buf_size

protected int send_buf_size

send_queue_size

protected int send_queue_size

sock_conn_timeout

protected int sock_conn_timeout

tcp_nodelay

protected boolean tcp_nodelay

linger

protected int linger

acceptor

protected final java.lang.Thread acceptor

running

protected final java.util.concurrent.atomic.AtomicBoolean running

use_send_queues

protected volatile boolean use_send_queues

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 external_port,
                        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 external_port,
                        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 external_port,
                        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 factory)

clientBindAddress

public java.net.InetAddress clientBindAddress()

clientBindAddress

public TCPConnectionMap clientBindAddress(java.net.InetAddress addr)

clientBindPort

public int clientBindPort()

clientBindPort

public TCPConnectionMap clientBindPort(int port)

deferClientBinding

public boolean deferClientBinding()

deferClientBinding

public TCPConnectionMap deferClientBinding(boolean defer)

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()

setSocketParameters

protected void setSocketParameters(java.net.Socket client_sock)
                            throws java.net.SocketException
Throws:
java.net.SocketException

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


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.