-
public interface TransportI/O transport binding that handles asynchronous I/O operations for a non-blocking NIO channel. ATransportprovides a selectablechannel()on which to perform asynchronous I/O operations, along with anreadBuffer()into which input data will be read, and anwriteBuffer()from which data will be written.A
Transportinterfaces with the underlying asynchronous I/O system via aTransportContext. The transport context invokes I/O callbacks on theTransportwhen the underlying NIO channel is ready to perform I/O operations permitted by the transport context'sFlowControl.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SelectableChannelchannel()Returns the NIO channel that thisTransportmanages.voiddidClose()Lifecycle callback invoked by the transport context after the underlying transport has closed.voiddidFail(Throwable error)Lifecycle callback invoked by the transport context when the underlying transport fails by throwing anerror.voiddidTimeout()Lifecycle callback invoked by the transport context after the underlying transport has timed out.voiddidWrite()I/O callback invoked by the transport context after the underlying transport has completed writing all data in itswriteBuffer, thereby completing the current write operation.voiddoAccept()I/O callback invoked by the transport context when the underlying transport is ready to complete an accept operation.voiddoConnect()I/O callback invoked by the transport context when the underlying transport is ready to complete a connect operation.voiddoRead()I/O callback invoked by the transport context asking thisTransportto read input data out of thereadBuffer, thereby completing a read operation from the underlying I/O transport.voiddoWrite()I/O callback invoked by the transport context asking thisTransportto write output data into thewriteBuffer, thereby initiating a write operation to the underlying I/O transport.longidleTimeout()Returns the number of idle milliseconds after which thisTransportshould be closed due to inactivity.ByteBufferreadBuffer()Returns the buffer into which input data should be read by the underlying I/O transport.voidsetTransportContext(TransportContext context)Sets the I/O transport context to which thisTransportis bound.TransportContexttransportContext()Returns the I/O transport context to which thisTransportis bound; returnsnullif thisTransportis unbound.ByteBufferwriteBuffer()Returns the buffer from which output data should be written by the underlying I/O transport.
-
-
-
Method Detail
-
transportContext
TransportContext transportContext()
Returns the I/O transport context to which thisTransportis bound; returnsnullif thisTransportis unbound.
-
setTransportContext
void setTransportContext(TransportContext context)
Sets the I/O transport context to which thisTransportis bound.
-
channel
SelectableChannel channel()
Returns the NIO channel that thisTransportmanages.
-
readBuffer
ByteBuffer readBuffer()
Returns the buffer into which input data should be read by the underlying I/O transport.
-
writeBuffer
ByteBuffer writeBuffer()
Returns the buffer from which output data should be written by the underlying I/O transport.
-
idleTimeout
long idleTimeout()
Returns the number of idle milliseconds after which thisTransportshould be closed due to inactivity. Returns-1if a default idle timeout should be used. Returns0if the underlying I/O transport should not time out.
-
doAccept
void doAccept() throws IOExceptionI/O callback invoked by the transport context when the underlying transport is ready to complete an accept operation.- Throws:
IOException
-
doConnect
void doConnect() throws IOExceptionI/O callback invoked by the transport context when the underlying transport is ready to complete a connect operation.- Throws:
IOException
-
doRead
void doRead()
I/O callback invoked by the transport context asking thisTransportto read input data out of thereadBuffer, thereby completing a read operation from the underlying I/O transport. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoReadcalls.
-
doWrite
void doWrite()
I/O callback invoked by the transport context asking thisTransportto write output data into thewriteBuffer, thereby initiating a write operation to the underlying I/O transport. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.
-
didWrite
void didWrite()
I/O callback invoked by the transport context after the underlying transport has completed writing all data in itswriteBuffer, thereby completing the current write operation. May be invoked concurrently to other I/O callbacks, but never concurrently with otherdoWriteordidWritecalls.
-
didTimeout
void didTimeout()
Lifecycle callback invoked by the transport context after the underlying transport has timed out. The transport will automatically be closed.
-
didClose
void didClose()
Lifecycle callback invoked by the transport context after the underlying transport has closed.
-
didFail
void didFail(Throwable error)
Lifecycle callback invoked by the transport context when the underlying transport fails by throwing anerror. The transport will automatically be closed.
-
-