com.sun.grizzly.async
Interface AsyncQueueWritable

All Known Subinterfaces:
ConnectorHandler<E,P>
All Known Implementing Classes:
AbstractConnectorHandler, CacheableConnectorHandler, SSLConnectorHandler, TCPConnectorHandler, UDPConnectorHandler

public interface AsyncQueueWritable

Object, which is able to send ByteBuffer data asynchronously, using queue.

Author:
Alexey Stashok

Method Summary
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer)
          Method writes ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler)
          Method writes ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler, AsyncQueueDataProcessor writePreProcessor)
          Method writes ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler, AsyncQueueDataProcessor writePreProcessor, ByteBufferCloner cloner)
          Method writes ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress, ByteBuffer buffer)
          Method sends ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress, ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler)
          Method sends ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress, ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler, AsyncQueueDataProcessor writePreProcessor)
          Method sends ByteBuffer using async write queue.
 Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress, ByteBuffer buffer, AsyncWriteCallbackHandler callbackHandler, AsyncQueueDataProcessor writePreProcessor, ByteBufferCloner cloner)
          Method sends ByteBuffer using async write queue.
 

Method Detail

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer)
                                              throws IOException
Method writes ByteBuffer using async write queue. First, if write queue is empty - it tries to write ByteBuffer 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. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise it will be just logged by Grizzly framework.

Parameters:
buffer - ByteBuffer
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler)
                                              throws IOException
Method writes ByteBuffer using async write queue. First, if write queue is empty - it tries to write ByteBuffer 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. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will come via AsyncWriteCallbackHandler.onIOException()

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler,
                                              AsyncQueueDataProcessor writePreProcessor)
                                              throws IOException
Method writes ByteBuffer using async write queue. First, if write queue is empty - it tries to write ByteBuffer 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. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will 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.

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
writePreProcessor - AsyncQueueDataProcessor, which will perform data processing, before it will be written on SelectableChannel
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler,
                                              AsyncQueueDataProcessor writePreProcessor,
                                              ByteBufferCloner cloner)
                                              throws IOException
Method writes ByteBuffer using async write queue. First, if write queue is empty - it tries to write ByteBuffer 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. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will 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.

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
writePreProcessor - AsyncQueueDataProcessor, which will perform data processing, before it will be written on SelectableChannel
isCloneByteBuffer - if true - AsyncQueueWriter will clone given ByteBuffer before puting it to the AsyncQueue
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress,
                                              ByteBuffer buffer)
                                              throws IOException
Method sends ByteBuffer using async write queue. First, if write queue is empty - it tries to send ByteBuffer to the given SocketAddress directly (without putting to the queue). If associated write queue is not empty or after direct sending ByteBuffer still has ready data to be written - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise it will be just logged by Grizzly framework.

Parameters:
dstAddress - destination SocketAddress data will be sent to
buffer - ByteBuffer
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress,
                                              ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler)
                                              throws IOException
Method sends ByteBuffer using async write queue. First, if write queue is empty - it tries to send ByteBuffer to the given SocketAddress directly (without putting to the queue). If associated write queue is not empty or after direct sending ByteBuffer still has ready data to be written - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will come via AsyncWriteCallbackHandler.onIOException()

Parameters:
dstAddress - destination SocketAddress data will be sent to
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress,
                                              ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler,
                                              AsyncQueueDataProcessor writePreProcessor)
                                              throws IOException
Method sends ByteBuffer using async write queue. First, if write queue is empty - it tries to send ByteBuffer to the given SocketAddress directly (without putting to the queue). If associated write queue is not empty or after direct sending ByteBuffer still has ready data to be written - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will 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.

Parameters:
dstAddress - destination SocketAddress data will be sent to
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
writePreProcessor - AsyncQueueDataProcessor, which will perform data processing, before it will be written on SelectableChannel
Throws:
IOException

writeToAsyncQueue

Future<AsyncQueueWriteUnit> writeToAsyncQueue(SocketAddress dstAddress,
                                              ByteBuffer buffer,
                                              AsyncWriteCallbackHandler callbackHandler,
                                              AsyncQueueDataProcessor writePreProcessor,
                                              ByteBufferCloner cloner)
                                              throws IOException
Method sends ByteBuffer using async write queue. First, if write queue is empty - it tries to send ByteBuffer to the given SocketAddress directly (without putting to the queue). If associated write queue is not empty or after direct sending ByteBuffer still has ready data to be written - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct writing - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a writing queue - exception notification will 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.

Parameters:
dstAddress - destination SocketAddress data will be sent to
buffer - ByteBuffer
callbackHandler - AsyncWriteCallbackHandler, which will get notified, when ByteBuffer will be completely written
writePreProcessor - AsyncQueueDataProcessor, which will perform data processing, before it will be written on SelectableChannel
isCloneByteBuffer - if true - AsyncQueueWriter will clone given ByteBuffer before puting it to the AsyncQueue
Throws:
IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.