public final class NIOTcpPacketTransport extends AbstractTcpPacketTransport implements NIOClientSocketHandler
| Modifier and Type | Field and Description |
|---|---|
protected long |
lastRecvActivity |
protected long |
lastSendActivity |
protected static org.apache.commons.logging.Log |
log |
initialPacketBufferSize, pingInterval, sendQueueMaxSize, socketRecvBufferSize, socketSendBufferSize, streamRecvBufferSize, streamSendBufferSize| Constructor and Description |
|---|
NIOTcpPacketTransport(String id,
NIOTcpMultiplexer multiplexer,
SocketChannel socketChannel,
Settings settings)
Constructor
|
NIOTcpPacketTransport(String id,
NIOTcpMultiplexer multiplexer,
URI transportURI,
Settings settings)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
appendOutgoingData()
Append some outgoing data to the output buffer
|
void |
close()
Stop and close the transport layer
|
protected void |
closeTransport(boolean linkFailed) |
ByteBuffer |
getInputBuffer()
Get this client's input buffer
|
ByteBuffer |
getOutputBuffer()
Get this client's output buffer
|
SocketAddress |
getRemotePeer()
Get the remote peer address
|
SocketChannel |
getSocketChannel()
Get the associated socket channel
|
boolean |
handleIncomingData()
Process incoming data available in the input buffer
|
boolean |
hasWriteInterest()
Test if this client has things to sends
|
boolean |
needsThrottling()
Test if send operation should be throttled down to avoid send queue overflow
|
void |
onSocketChannelClosed()
Called if the multiplexer closes the socket channel after a network error
|
void |
send(AbstractPacket packet)
Send a packet on this transport
|
void |
start()
Start the transport layer
|
getRemotePeerIDgetId, isClosed, setListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIdprotected static final org.apache.commons.logging.Log log
protected long lastSendActivity
protected long lastRecvActivity
public NIOTcpPacketTransport(String id, NIOTcpMultiplexer multiplexer, URI transportURI, Settings settings) throws PacketTransportException
PacketTransportExceptionpublic NIOTcpPacketTransport(String id, NIOTcpMultiplexer multiplexer, SocketChannel socketChannel, Settings settings)
public SocketAddress getRemotePeer()
AbstractTcpPacketTransportgetRemotePeer in class AbstractTcpPacketTransportpublic ByteBuffer getInputBuffer()
NIOClientSocketHandlergetInputBuffer in interface NIOClientSocketHandlerpublic ByteBuffer getOutputBuffer()
NIOClientSocketHandlergetOutputBuffer in interface NIOClientSocketHandlerpublic SocketChannel getSocketChannel()
NIOClientSocketHandlergetSocketChannel in interface NIOClientSocketHandlerpublic boolean handleIncomingData()
NIOClientSocketHandlerhandleIncomingData in interface NIOClientSocketHandlerpublic boolean appendOutgoingData()
NIOClientSocketHandlerappendOutgoingData in interface NIOClientSocketHandlerpublic boolean hasWriteInterest()
NIOClientSocketHandlerhasWriteInterest in interface NIOClientSocketHandlerpublic void send(AbstractPacket packet) throws PacketTransportException
PacketTransportsend in interface PacketTransportPacketTransportExceptionpublic boolean needsThrottling()
PacketTransportneedsThrottling in interface PacketTransportpublic void start()
throws PacketTransportException
PacketTransportstart in interface PacketTransportPacketTransportExceptionprotected void closeTransport(boolean linkFailed)
public void onSocketChannelClosed()
NIOClientSocketHandleronSocketChannelClosed in interface NIOClientSocketHandlerpublic void close()
PacketTransportclose in interface PacketTransportCopyright © 2021. All rights reserved.