Top Description Fields Constructors Methods
org.glassfish.grizzly.nio

public abstract Class AbstractNIOAsyncQueueReader

extends AbstractReader<SocketAddress>
implements AsyncQueueReader<SocketAddress>
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.asyncqueue.AsyncQueueReader, org.glassfish.grizzly.asyncqueue.AsyncQueue, org.glassfish.grizzly.Reader
Known Direct Subclasses
org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueReader, org.glassfish.grizzly.nio.transport.UDPNIOAsyncQueueReader
Annotations
@SuppressWarnings:unchecked
Imports
java.io.EOFException, .IOException, java.net.SocketAddress, java.util.logging.Level, .Logger, org.glassfish.grizzly.AbstractReader, .Buffer, .CompletionHandler, .Connection, .Context, .Grizzly, .Interceptor, .ReadResult, .Reader, org.glassfish.grizzly.asyncqueue.AsyncQueueReader, .AsyncReadQueueRecord, .TaskQueue

The AsyncQueueReader implementation, based on the Java NIO
Authors
Alexey Stashok, Ryan Lubke, Gustav Trede

Field Summary

Modifier and TypeField and Description
private EOFException
public static final int
protected int
private static final Logger
protected final NIOTransport

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
close()

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.close.

Close AsyncQueueProcessor and release associated resources

protected final int
doRead(final Connection<L>
the Connection to read from
connection
,
final AsyncReadQueueRecord
the record to be read to
queueRecord
)

Performs real read on the NIO channel

private static void
failure(final Throwable failure, final CompletionHandler<ReadResult<Buffer, SocketAddress>> completionHandler)

private int
intercept(final int event, final AsyncReadQueueRecord asyncQueueRecord, final ReadResult<K, L> currentResult)

public final boolean
isReady(final Connection<L> connection)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.isReady.

Checks whether there is ready data in AsyncQueue, associated with the Connection.

public void
onClose(Connection<L> connection)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.onClose.

Callback method, which is called, when Connection has been closed, to let processor release a connection associated resources.

protected final void
onReadFailure(final Connection<L> connection, final AsyncReadQueueRecord failedRecord, final IOException e)

protected abstract void
onReadyToRead(Connection<L> connection)

public AsyncQueue.AsyncResult
processAsync(final Context context)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.processAsync.

Callback method, which is called async.

public void
read(final Connection<SocketAddress> connection, Buffer buffer, final CompletionHandler<ReadResult<Buffer, SocketAddress>> completionHandler, final Interceptor<ReadResult<K, L>> interceptor)

Implements org.glassfish.grizzly.Reader.read.

Method reads data to the buffer.

protected abstract int
read0(Connection<L> connection, Buffer buffer, ReadResult<Buffer, SocketAddress> currentResult)

Inherited from org.glassfish.grizzly.AbstractReader:
readreadread

Field Detail

cachedEOFExceptionback to summary
private EOFException cachedEOFException
DEFAULT_BUFFER_SIZEback to summary
public static final int DEFAULT_BUFFER_SIZE
defaultBufferSizeback to summary
protected int defaultBufferSize
LOGGERback to summary
private static final Logger LOGGER
transportback to summary
protected final NIOTransport transport

Constructor Detail

AbstractNIOAsyncQueueReaderback to summary
public AbstractNIOAsyncQueueReader(NIOTransport transport)

Method Detail

closeback to summary
public final void close()

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.close.

Doc from org.glassfish.grizzly.asyncqueue.AsyncQueue.close.

Close AsyncQueueProcessor and release associated resources

Annotations
@Override
doReadback to summary
protected final int doRead(final Connection<L> connection, final AsyncReadQueueRecord queueRecord) throws IOException

Performs real read on the NIO channel

Parameters
connection:Connection<L>

the Connection to read from

queueRecord:AsyncReadQueueRecord

the record to be read to

failureback to summary
private static void failure(final Throwable failure, final CompletionHandler<ReadResult<Buffer, SocketAddress>> completionHandler)
interceptback to summary
private int intercept(final int event, final AsyncReadQueueRecord asyncQueueRecord, final ReadResult<K, L> currentResult)
isReadyback to summary
public final boolean isReady(final Connection<L> connection)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.isReady.

Doc from org.glassfish.grizzly.asyncqueue.AsyncQueue.isReady.

Checks whether there is ready data in AsyncQueue, associated with the Connection.

Annotations
@Override
onCloseback to summary
public void onClose(Connection<L> connection)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.onClose.

Doc from org.glassfish.grizzly.asyncqueue.AsyncQueue.onClose.

Callback method, which is called, when Connection has been closed, to let processor release a connection associated resources.

Annotations
@Override
onReadFailureback to summary
protected final void onReadFailure(final Connection<L> connection, final AsyncReadQueueRecord failedRecord, final IOException e)
onReadyToReadback to summary
protected abstract void onReadyToRead(Connection<L> connection) throws IOException
processAsyncback to summary
public AsyncQueue.AsyncResult processAsync(final Context context)

Implements org.glassfish.grizzly.asyncqueue.AsyncQueue.processAsync.

Doc from org.glassfish.grizzly.asyncqueue.AsyncQueue.processAsync.

Callback method, which is called async. to process ready AsyncQueue, which are associated with the given Connection

Annotations
@Override
readback to summary
public void read(final Connection<SocketAddress> connection, Buffer buffer, final CompletionHandler<ReadResult<Buffer, SocketAddress>> completionHandler, final Interceptor<ReadResult<K, L>> interceptor)

Implements org.glassfish.grizzly.Reader.read.

Doc from org.glassfish.grizzly.Reader.read.

Method reads data to the buffer.

Annotations
@Override
read0back to summary
protected abstract int read0(Connection<L> connection, Buffer buffer, ReadResult<Buffer, SocketAddress> currentResult) throws IOException