|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.async.AbstractAsyncQueueWriter
public abstract class AbstractAsyncQueueWriter
| Field Summary | |
|---|---|
protected SelectorHandler |
selectorHandler
|
| Constructor Summary | |
|---|---|
AbstractAsyncQueueWriter(SelectorHandler selectorHandler)
|
|
| Method Summary | |
|---|---|
void |
close()
Close AsyncQueueWriter and release its resources |
protected OperationResult |
doWrite(WritableByteChannel channel,
SocketAddress dstAddress,
ByteBuffer byteBuffer,
AsyncQueueDataProcessor writePreProcessor,
OperationResult dstResult)
|
protected abstract OperationResult |
doWrite(WritableByteChannel channel,
SocketAddress dstAddress,
ByteBuffer byteBuffer,
OperationResult dstResult)
|
AsyncQueue.AsyncQueueEntry |
getAsyncQueue(SelectionKey key)
Gets ready asynchronous queue elements to be written to the SelectableChannel, associated with the
given SelectionKey |
boolean |
isReady(SelectionKey key)
Checks whether there is any data in AsyncQueue ready
to be written to the SelectableChannel, associated with the
given SelectionKey |
void |
onClose(SelectableChannel channel)
Callback method, which should be called by SelectorHandler to
notify, that given SelectableChannel is going to be closed, so
related SelectableChannel data could be released from
AsyncQueue |
void |
onWrite(SelectionKey key)
Callback method, which should be called by SelectorHandler to
notify, that SelectableChannel, associated with the given
SelectionKey is ready to transmit data. |
protected void |
registerForWriting(SelectionKey key)
|
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
ByteBuffer buffer)
Method writes ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler)
Method writes ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor)
Method writes ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor,
ByteBufferCloner cloner)
Method writes ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer)
Method sends ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler)
Method sends ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor)
Method sends ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue). |
Future<AsyncQueueWriteUnit> |
write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor,
ByteBufferCloner cloner)
Method sends ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SelectorHandler selectorHandler
| Constructor Detail |
|---|
public AbstractAsyncQueueWriter(SelectorHandler selectorHandler)
| Method Detail |
|---|
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
ByteBuffer buffer)
throws IOException
ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly, otherwise it will be just logged by
Grizzly framework.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written tobuffer - ByteBuffer
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler)
throws IOException
ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely written
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor)
throws IOException
ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
Before data will be written on SelectableChannel, first it
will be passed for preprocessing to AsyncQueueDataProcessor,
and then preprocessor result data
(AsyncQueueDataProcessor.getResultByteBuffer()) will be
written on the SelectableChannel.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely writtenwritePreProcessor - AsyncQueueDataProcessor, which
will perform data processing, before it will be
written on SelectableChannel
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor,
ByteBufferCloner cloner)
throws IOException
ByteBuffer to the SelectableChannel
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SelectableChannel directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
Before data will be written on SelectableChannel, first it
will be passed for preprocessing to AsyncQueueDataProcessor,
and then preprocessor result data
(AsyncQueueDataProcessor.getResultByteBuffer()) will be
written on the SelectableChannel.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely writtenwritePreProcessor - AsyncQueueDataProcessor, which
will perform data processing, before it will be
written on SelectableChannel
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer)
throws IOException
ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly, otherwise it will be just logged by
Grizzly framework.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel, which will be used to
sendByteBuffer todstAddress - destination address ByteBuffer will be sent tobuffer - ByteBuffer
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler)
throws IOException
ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written todstAddress - destination address ByteBuffer will be sent tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely written
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor)
throws IOException
ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
Before data will be written on SelectableChannel, first it
will be passed for preprocessing to AsyncQueueDataProcessor,
and then preprocessor result data
(AsyncQueueDataProcessor.getResultByteBuffer()) will be
written on the SelectableChannel.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written todstAddress - destination address ByteBuffer will be sent tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely writtenwritePreProcessor - AsyncQueueDataProcessor, which
will perform data processing, before it will be
written on SelectableChannel
IOException
public Future<AsyncQueueWriteUnit> write(SelectionKey key,
SocketAddress dstAddress,
ByteBuffer buffer,
AsyncWriteCallbackHandler callbackHandler,
AsyncQueueDataProcessor writePreProcessor,
ByteBufferCloner cloner)
throws IOException
ByteBuffer to the SocketAddress
First, if SelectableChannel associated write queue is empty -
it tries to write ByteBuffer to the given
SocketAddress directly (without putting to the queue).
If associated write queue is not empty or after direct writing
ByteBuffer still has ready data to be written -
ByteBuffer will be added to AsyncQueue
and SelectableChannel will be registered on
SelectorHandler, waiting for OP_WRITE event.
If an exception occurs, during direct writing - it will be propagated
to the caller directly and come via
AsyncWriteCallbackHandler.onIOException()
Before data will be written on SelectableChannel, first it
will be passed for preprocessing to AsyncQueueDataProcessor,
and then preprocessor result data
(AsyncQueueDataProcessor.getResultByteBuffer()) will be
written on the SelectableChannel.
write in interface AsyncQueueWriterkey - SelectionKey associated with
SelectableChannel ByteBuffer
should be written todstAddress - destination address ByteBuffer will be sent tobuffer - ByteBuffercallbackHandler - AsyncWriteCallbackHandler,
which will get notified, when
ByteBuffer will be completely writtenwritePreProcessor - AsyncQueueDataProcessor, which
will perform data processing, before it will be
written on SelectableChannel
IOExceptionpublic boolean isReady(SelectionKey key)
AsyncQueue ready
to be written to the SelectableChannel, associated with the
given SelectionKey
isReady in interface AsyncQueueWriterkey - SelectionKey associated with SelectableChannel
public AsyncQueue.AsyncQueueEntry getAsyncQueue(SelectionKey key)
SelectableChannel, associated with the
given SelectionKey
getAsyncQueue in interface AsyncQueueWriterkey - SelectionKey associated with SelectableChannel
SelectableChannel, associated with the
given SelectionKey/
public void onWrite(SelectionKey key)
throws IOException
SelectorHandler to
notify, that SelectableChannel, associated with the given
SelectionKey is ready to transmit data.
onWrite in interface AsyncQueueWriterkey - SelectionKey associated with SelectableChannel
IOExceptionpublic void onClose(SelectableChannel channel)
SelectorHandler to
notify, that given SelectableChannel is going to be closed, so
related SelectableChannel data could be released from
AsyncQueue
onClose in interface AsyncQueueWriterpublic void close()
AsyncQueueWriter and release its resources
close in interface AsyncQueueWriter
protected OperationResult doWrite(WritableByteChannel channel,
SocketAddress dstAddress,
ByteBuffer byteBuffer,
AsyncQueueDataProcessor writePreProcessor,
OperationResult dstResult)
throws IOException
IOException
protected abstract OperationResult doWrite(WritableByteChannel channel,
SocketAddress dstAddress,
ByteBuffer byteBuffer,
OperationResult dstResult)
throws IOException
IOExceptionprotected void registerForWriting(SelectionKey key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||