com.sun.grizzly.async
Interface AsyncReadCallbackHandler


public interface AsyncReadCallbackHandler

Callback handler interface, used by AsyncQueueReader to notify custom code either about completion of specific ByteBuffer reading or about IO problem, which occured when reading data to a ByteBuffer

Author:
Alexey Stashok

Method Summary
 void onException(Exception exception, SelectionKey key, ByteBuffer buffer, Queue<AsyncQueueReadUnit> remainingQueue)
          Method will be called by AsyncQueueReader, if error occured when reading from the SelectableChannel, which is associated with SelectionKey
 void onReadCompleted(SelectionKey key, SocketAddress srcAddress, AsyncQueueReadUnit readRecord)
          Method will be called by AsyncQueueReader, if data was read to the ByteBuffer from the SelectableChannel, associated with SelectionKey, and read data confirms to the user-specific condition (if any was set).
 

Method Detail

onReadCompleted

void onReadCompleted(SelectionKey key,
                     SocketAddress srcAddress,
                     AsyncQueueReadUnit readRecord)
Method will be called by AsyncQueueReader, if data was read to the ByteBuffer from the SelectableChannel, associated with SelectionKey, and read data confirms to the user-specific condition (if any was set).

Parameters:
key - SelectionKey, associated with input SelectableChannel
srcAddress - sender's SocketAddress
readRecord - AsyncWriteQueueRecord, which was successfuly read

onException

void onException(Exception exception,
                 SelectionKey key,
                 ByteBuffer buffer,
                 Queue<AsyncQueueReadUnit> remainingQueue)
Method will be called by AsyncQueueReader, if error occured when reading from the SelectableChannel, which is associated with SelectionKey

Parameters:
exception - occurred Exception
key - SelectionKey, associated with input SelectableChannel
buffer - ByteBuffer, which supposed to be used for asynchronous reading. ByteBuffer could contain some data, which was successfully read before error occured


Copyright © 2013 Oracle Corporation. All Rights Reserved.