com.sun.grizzly.async
Interface AsyncQueueReadable

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

public interface AsyncQueueReadable

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

Author:
Alexey Stashok

Method Summary
 Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler)
          Method reads data to the ByteBuffer using async read queue.
 Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler, AsyncReadCondition condition)
          Method reads data to the ByteBuffer using async read queue.
 Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer, AsyncReadCallbackHandler callbackHandler, AsyncReadCondition condition, AsyncQueueDataProcessor readPostProcessor)
          Method reads data to the ByteBuffer using async read queue.
 

Method Detail

readFromAsyncQueue

Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer,
                                              AsyncReadCallbackHandler callbackHandler)
                                              throws IOException
Method reads data to the ByteBuffer using async read queue. First, if read queue is empty - it tries to read to the ByteBuffer directly (without putting to the queue). If associated read queue is not empty or after direct reading ByteBuffer still has remaining place for next read - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct reading - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a reading queue - exception notification will come via AsyncReadCallbackHandler.onIOException()

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncReadCallbackHandler, which will get notified, when ByteBuffer will get full
Returns:
true, if ByteBuffer was read completely, false if read operation was put to queue
Throws:
IOException

readFromAsyncQueue

Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer,
                                              AsyncReadCallbackHandler callbackHandler,
                                              AsyncReadCondition condition)
                                              throws IOException
Method reads data to the ByteBuffer using async read queue. First, if read queue is empty - it tries to read to the ByteBuffer directly (without putting to the queue). If associated read queue is not empty or after direct reading ByteBuffer still has remaining place for next read - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct reading - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a reading queue - exception notification will come via AsyncReadCallbackHandler.onIOException()

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncReadCallbackHandler, which will get notified, when ByteBuffer will get full
condition - AsyncReadCondition, which will be called to check if read data is complete, and callbackHandler could be called
Returns:
true, if ByteBuffer was read completely, false if read operation was put to queue
Throws:
IOException

readFromAsyncQueue

Future<AsyncQueueReadUnit> readFromAsyncQueue(ByteBuffer buffer,
                                              AsyncReadCallbackHandler callbackHandler,
                                              AsyncReadCondition condition,
                                              AsyncQueueDataProcessor readPostProcessor)
                                              throws IOException
Method reads data to the ByteBuffer using async read queue. First, if read queue is empty - it tries to read to the ByteBuffer directly (without putting to the queue). If associated read queue is not empty or after direct reading ByteBuffer still has remaining place for next read - ByteBuffer will be added to AsyncQueue. If an exception occurs, during direct reading - it will be propagated to the caller directly, otherwise, if the ByteBuffer is added to a reading queue - exception notification will come via AsyncReadCallbackHandler.onIOException()

Parameters:
buffer - ByteBuffer
callbackHandler - AsyncReadCallbackHandler, which will get notified, when ByteBuffer will get full
condition - AsyncReadCondition, which will be called to check if read data is complete, and callbackHandler could be called
readPostProcessor - post processor, to be called to process read data
Returns:
true, if ByteBuffer was read completely, false if read operation was put to queue
Throws:
IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.