public class TcpTransport extends java.lang.Object implements Transport, ReactorHandler, java.lang.Runnable
| Constructor and Description |
|---|
TcpTransport(ContextImpl context,
TransportClient client,
ResponseHandlers.ResponseHandler responseHandler,
java.nio.channels.SocketChannel channel,
short remoteTransportRevision,
int priority)
Constructs a new object for managing the TCP connection with a remote server.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acquire(TransportClient client)
Acquires transport.
|
java.nio.ByteBuffer |
acquireSendBuffer(int requiredSize) |
void |
close(boolean remotelyClosed)
Close connection.
|
protected void |
disableFlowControl()
Disable flow control (enables events).
|
protected void |
enableFlowControl()
Enable flow control (disables events).
|
void |
flush() |
protected void |
flush(boolean wait) |
ContextImpl |
getContext()
Get context transport is living in.
|
short |
getMinorRevision()
Transport protocol minor revision.
|
int |
getPriority() |
java.net.InetSocketAddress |
getRemoteAddress()
Get remote address.
|
void |
handleEvent(java.nio.channels.SelectionKey key)
Handle IO event.
|
protected void |
processRead()
Process input obtained via channel (read) IO event.
|
protected void |
processReadBuffer()
Process input from receive buffer
|
protected void |
processWrite()
Process output (write) IO event.
|
void |
release(TransportClient client)
Releases transport.
|
void |
releaseSendBuffer(boolean ignore,
boolean flush) |
void |
run()
Echo timer.
|
public TcpTransport(ContextImpl context, TransportClient client, ResponseHandlers.ResponseHandler responseHandler, java.nio.channels.SocketChannel channel, short remoteTransportRevision, int priority)
context - the CA context in which the communication takes place.responseHandler - reference to an object which will manage the handling of the server responses.client - the client.channel - socket through which communication will flow.remoteTransportRevision - the CA transport revision (a constant) to be used in communication.priority - the CA message priority.public void close(boolean remotelyClosed)
remotelyClosed - flag indicating weather the socket has already been remotely closedpublic boolean acquire(TransportClient client)
client - client (channel) acquiring the transporttrue if transport was granted, false otherwise.public void release(TransportClient client)
client - client (channel) releasing the transportpublic short getMinorRevision()
TransportgetMinorRevision in interface Transportpublic void handleEvent(java.nio.channels.SelectionKey key)
handleEvent in interface ReactorHandlerkey - key to be processed.protected void processRead()
protected void processReadBuffer()
protected void processWrite()
protected void disableFlowControl()
protected void enableFlowControl()
public ContextImpl getContext()
TransportgetContext in interface Transportpublic java.nio.ByteBuffer acquireSendBuffer(int requiredSize)
acquireSendBuffer in interface Transportpublic void releaseSendBuffer(boolean ignore,
boolean flush)
releaseSendBuffer in interface Transportprotected void flush(boolean wait)
public java.net.InetSocketAddress getRemoteAddress()
TransportgetRemoteAddress in interface Transportpublic int getPriority()
getPriority in interface Transportpublic void run()
run in interface java.lang.Runnable