com.crankuptheamps.client
Class TCPTransportImpl

java.lang.Object
  extended by com.crankuptheamps.client.TCPTransportImpl

public class TCPTransportImpl
extends Object


Field Summary
protected  TransportFilter _filter
           
 Lock _lock
           
protected  SocketChannel _socket
           
 
Constructor Summary
TCPTransportImpl(Protocol messageType, Properties properties, TransportFilter filter)
           
 
Method Summary
 void connect(URI addr)
           
protected  SocketChannel createSocket()
           
 void disconnect()
           
 long flush()
           
 long flush(long timeout)
           
 void handleCloseEvent(int failedVersion, String message, Exception e_)
           
 long readQueueSize()
           
 void send(ByteBuffer buf)
           
 void setDisconnectHandler(TransportDisconnectHandler h)
           
 void setExceptionListener(ExceptionListener exceptionListener)
           
 void setMessageHandler(MessageHandler h)
           
 void setReadTimeout(int readTimeoutMillis_)
           
 void setTransportFilter(TransportFilter filter)
           
 Socket socket()
           
 long writeQueueSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_socket

protected SocketChannel _socket

_lock

public final Lock _lock

_filter

protected TransportFilter _filter
Constructor Detail

TCPTransportImpl

public TCPTransportImpl(Protocol messageType,
                        Properties properties,
                        TransportFilter filter)
Method Detail

setMessageHandler

public void setMessageHandler(MessageHandler h)

setDisconnectHandler

public void setDisconnectHandler(TransportDisconnectHandler h)

setExceptionListener

public void setExceptionListener(ExceptionListener exceptionListener)

setTransportFilter

public void setTransportFilter(TransportFilter filter)

connect

public void connect(URI addr)
             throws ConnectionRefusedException,
                    AlreadyConnectedException,
                    InvalidURIException
Throws:
ConnectionRefusedException
AlreadyConnectedException
InvalidURIException

createSocket

protected SocketChannel createSocket()
                              throws IOException
Throws:
IOException

disconnect

public void disconnect()

send

public void send(ByteBuffer buf)
          throws DisconnectedException
Throws:
DisconnectedException

socket

public Socket socket()

writeQueueSize

public long writeQueueSize()

readQueueSize

public long readQueueSize()

flush

public long flush()

flush

public long flush(long timeout)

handleCloseEvent

public void handleCloseEvent(int failedVersion,
                             String message,
                             Exception e_)
                      throws RetryOperationException,
                             DisconnectedException
Throws:
RetryOperationException
DisconnectedException

setReadTimeout

public void setReadTimeout(int readTimeoutMillis_)