com.sun.grizzly.async
Interface AsyncQueueReadable

All Known Implementing Classes:
SSLConnectorHandler, TCPConnectorHandler, UDPConnectorHandler

public interface AsyncQueueReadable

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

Author:
Alexey Stashok

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

Method Detail

readFromAsyncQueue

void 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
Throws:
IOException

readFromAsyncQueue

void 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
Throws:
IOException

readFromAsyncQueue

void 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
Throws:
IOException


Copyright © 2008 SUN Microsystems. All Rights Reserved.