com.sun.grizzly.http
Class SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl

java.lang.Object
  extended by com.sun.grizzly.http.SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl
All Implemented Interfaces:
AsyncWriteCallbackHandler
Direct Known Subclasses:
SSLOutputBuffer.AsyncWriteCallbackHandlerImpl
Enclosing class:
SocketChannelOutputBuffer

protected static class SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl
extends Object
implements AsyncWriteCallbackHandler

AsyncWriteCallbackHandler implementation, which is responsible for returning cloned ByteBuffers to the pool


Constructor Summary
protected SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl()
           
 
Method Summary
 void onException(Exception exception, SelectionKey key, ByteBuffer buffer, Queue<AsyncQueueWriteUnit> remainingQueue)
          Method will be called by AsyncQueueWriter, if error occured when writing ByteBuffer to the SelectableChannel, associated with SelectionKey
 void onWriteCompleted(SelectionKey key, AsyncQueueWriteUnit writtenRecord)
          Method will be called by AsyncQueueWriter, if whole ByteBuffer data was written to the SelectableChannel, associated with SelectionKey
protected  boolean releaseAsyncWriteUnit(AsyncQueueWriteUnit unit)
           
protected  boolean returnBuffer(ByteBuffer buffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl

protected SocketChannelOutputBuffer.AsyncWriteCallbackHandlerImpl()
Method Detail

onWriteCompleted

public void onWriteCompleted(SelectionKey key,
                             AsyncQueueWriteUnit writtenRecord)
Description copied from interface: AsyncWriteCallbackHandler
Method will be called by AsyncQueueWriter, if whole ByteBuffer data was written to the SelectableChannel, associated with SelectionKey

Specified by:
onWriteCompleted in interface AsyncWriteCallbackHandler
Parameters:
key - SelectionKey, associated with output SelectableChannel
writtenRecord - AsyncWriteQueueRecord, which was successfuly written

onException

public void onException(Exception exception,
                        SelectionKey key,
                        ByteBuffer buffer,
                        Queue<AsyncQueueWriteUnit> remainingQueue)
Description copied from interface: AsyncWriteCallbackHandler
Method will be called by AsyncQueueWriter, if error occured when writing ByteBuffer to the SelectableChannel, associated with SelectionKey

Specified by:
onException in interface AsyncWriteCallbackHandler
Parameters:
exception - occurred Exception
key - SelectionKey, associated with output SelectableChannel
buffer - ByteBuffer, which data was failed to be written
remainingQueue - queue of write records which were not written yet at the moment, when exception occured

releaseAsyncWriteUnit

protected boolean releaseAsyncWriteUnit(AsyncQueueWriteUnit unit)

returnBuffer

protected boolean returnBuffer(ByteBuffer buffer)


Copyright © 2012 Oracle Corporation. All Rights Reserved.