|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.AbstractReader<SocketAddress>
org.glassfish.grizzly.nio.AbstractNIOAsyncQueueReader
public abstract class AbstractNIOAsyncQueueReader
The AsyncQueueReader implementation, based on the Java NIO
| Field Summary | |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
|
protected int |
defaultBufferSize
|
protected NIOTransport |
transport
|
| Fields inherited from interface org.glassfish.grizzly.Reader |
|---|
COMPLETE_EVENT, INCOMPLETE_EVENT, READ_EVENT |
| Fields inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueueProcessor |
|---|
NOT_REGISTER_KEY |
| Constructor Summary | |
|---|---|
AbstractNIOAsyncQueueReader(NIOTransport transport)
|
|
| Method Summary | |
|---|---|
void |
close()
Close AsyncQueueProcessor and release associated resources |
protected int |
doRead(Connection connection,
ReadResult currentResult,
Buffer message)
Performs real read on the NIO channel |
protected void |
failReadRecord(Connection connection,
AsyncReadQueueRecord record,
IOException e)
|
ObjectPool |
getContextPool()
|
boolean |
isInterested(IOEvent ioEvent)
Is this Processor interested in processing the i/o event |
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 |
onReadCompleted(Connection connection,
AsyncReadQueueRecord record)
|
protected void |
onReadFailure(Connection connection,
AsyncReadQueueRecord failedRecord,
IOException e)
|
protected void |
onReadIncompleted(Connection connection,
AsyncReadQueueRecord record)
|
protected abstract void |
onReadyToRead(Connection connection)
|
ProcessorResult |
process(Context context)
Method will be called by framework to process some event, which occured on a connection |
void |
processAsync(Connection connection)
Callback method, which is called async. |
Future<ReadResult<Buffer,SocketAddress>> |
read(Connection connection,
Buffer buffer,
CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler,
Interceptor<ReadResult> interceptor)
Method reads data to the buffer. |
protected abstract int |
read0(Connection connection,
Buffer buffer,
ReadResult<Buffer,SocketAddress> currentResult)
|
void |
setInterested(IOEvent ioEvent,
boolean isInterested)
Set the the i/o event, this Processor is interested in |
| Methods inherited from class org.glassfish.grizzly.AbstractReader |
|---|
read, read, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.glassfish.grizzly.Reader |
|---|
read, read, read |
| Methods inherited from interface org.glassfish.grizzly.Processor |
|---|
afterProcess, beforeProcess, context |
| Field Detail |
|---|
public static final int DEFAULT_BUFFER_SIZE
protected int defaultBufferSize
protected NIOTransport transport
| Constructor Detail |
|---|
public AbstractNIOAsyncQueueReader(NIOTransport transport)
| Method Detail |
|---|
public Future<ReadResult<Buffer,SocketAddress>> read(Connection connection,
Buffer buffer,
CompletionHandler<ReadResult<Buffer,SocketAddress>> completionHandler,
Interceptor<ReadResult> interceptor)
throws IOException
read in interface Reader<SocketAddress>connection - the Connection to read frombuffer - the buffer, where 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.
Future, using which it's possible to check the result
IOExceptionpublic boolean isReady(Connection connection)
AsyncQueue,
associated with the Connection.
isReady in interface AsyncQueueProcessorconnection - Connection
public void processAsync(Connection connection)
throws IOException
AsyncQueue, which are associated with the given
Connection
processAsync in interface AsyncQueueProcessorconnection - Connection
IOExceptionpublic void onClose(Connection connection)
Connection has been closed,
to let processor release a connection associated resources.
onClose in interface AsyncQueueProcessorconnection - Connectionpublic ObjectPool getContextPool()
public boolean isInterested(IOEvent ioEvent)
Processor interested in processing the i/o event
isInterested in interface ProcessorProcessor is interested and execution
process will start, false otherwise.
public ProcessorResult process(Context context)
throws IOException
process in interface Processorcontext - processing context
IOException
public void setInterested(IOEvent ioEvent,
boolean isInterested)
Processor is interested in
setInterested in interface ProcessorioEvent - IOEventisInterested - true, if Processor is interested in
processing of the I/O event, or false otherwise.public void close()
close in interface AsyncQueueProcessor
protected int doRead(Connection connection,
ReadResult currentResult,
Buffer message)
throws IOException
connection - the Connection to read fromreadFuture - the asynchronous operation result holdermessage - the message to read to
IOException
protected void onReadCompleted(Connection connection,
AsyncReadQueueRecord record)
throws IOException
IOException
protected void onReadIncompleted(Connection connection,
AsyncReadQueueRecord record)
throws IOException
IOException
protected void onReadFailure(Connection connection,
AsyncReadQueueRecord failedRecord,
IOException e)
protected void failReadRecord(Connection connection,
AsyncReadQueueRecord record,
IOException e)
protected abstract int read0(Connection connection,
Buffer buffer,
ReadResult<Buffer,SocketAddress> currentResult)
throws IOException
IOException
protected abstract void onReadyToRead(Connection connection)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||