public abstract class AbstractNIOAsyncQueueReader extends AbstractReader<java.net.SocketAddress> implements AsyncQueueReader<java.net.SocketAddress>
AsyncQueueReader implementation, based on the Java NIOAsyncQueue.AsyncResult| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
protected int |
defaultBufferSize |
protected NIOTransport |
transport |
COMPLETE_EVENT, INCOMPLETE_EVENT, READ_EVENTEXPECTING_MORE_OPTION| Constructor and Description |
|---|
AbstractNIOAsyncQueueReader(NIOTransport transport) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close AsyncQueueProcessor and release associated resources
|
protected int |
doRead(Connection connection,
AsyncReadQueueRecord queueRecord)
Performs real read on the NIO channel
|
boolean |
isReady(Connection connection)
Checks whether there is ready data in
AsyncQueue,
associated with the Connection. |
void |
onClose(Connection connection)
Callback method, which is called, when
Connection has been closed,
to let processor release a connection associated resources. |
protected void |
onReadFailure(Connection connection,
AsyncReadQueueRecord failedRecord,
java.io.IOException e) |
protected abstract void |
onReadyToRead(Connection connection) |
AsyncQueue.AsyncResult |
processAsync(Context context)
Callback method, which is called async.
|
void |
read(Connection connection,
Buffer buffer,
CompletionHandler<ReadResult<Buffer,java.net.SocketAddress>> completionHandler,
Interceptor<ReadResult> interceptor)
Method reads data to the buffer.
|
protected abstract int |
read0(Connection connection,
Buffer buffer,
ReadResult<Buffer,java.net.SocketAddress> currentResult) |
read, read, readpublic static final int DEFAULT_BUFFER_SIZE
protected int defaultBufferSize
protected final NIOTransport transport
public AbstractNIOAsyncQueueReader(NIOTransport transport)
public void read(Connection connection, Buffer buffer, CompletionHandler<ReadResult<Buffer,java.net.SocketAddress>> completionHandler, Interceptor<ReadResult> interceptor)
read in interface Reader<java.net.SocketAddress>connection - the Connection to read frombuffer - the Buffer to which data will be readcompletionHandler - CompletionHandler,
which will get notified, when read will be completedinterceptor - Interceptor, which will be able to intercept
control each time new portion of a data was read to a
buffer.
The interceptor can decide, whether asynchronous read is
completed or not, or provide other processing instructions.public final boolean isReady(Connection connection)
AsyncQueue,
associated with the Connection.isReady in interface AsyncQueueconnection - Connectionpublic AsyncQueue.AsyncResult processAsync(Context context)
AsyncQueue, which are associated with the given
ConnectionprocessAsync in interface AsyncQueuecontext - ContextAsyncQueue.AsyncResult, depending on async queue status.public void onClose(Connection connection)
Connection has been closed,
to let processor release a connection associated resources.onClose in interface AsyncQueueconnection - Connectionpublic final void close()
close in interface AsyncQueueprotected final int doRead(Connection connection, AsyncReadQueueRecord queueRecord) throws java.io.IOException
connection - the Connection to read fromqueueRecord - the record to be read tojava.io.IOExceptionprotected final void onReadFailure(Connection connection, AsyncReadQueueRecord failedRecord, java.io.IOException e)
protected abstract int read0(Connection connection, Buffer buffer, ReadResult<Buffer,java.net.SocketAddress> currentResult) throws java.io.IOException
java.io.IOExceptionprotected abstract void onReadyToRead(Connection connection) throws java.io.IOException
java.io.IOExceptionCopyright © 2013 Oracle Corporation. All Rights Reserved.