voldemort.server.niosocket
Class AsyncRequestHandler

java.lang.Object
  extended by voldemort.common.nio.SelectorManagerWorker
      extended by voldemort.server.niosocket.AsyncRequestHandler
All Implemented Interfaces:
java.lang.Runnable

public class AsyncRequestHandler
extends SelectorManagerWorker

AsyncRequestHandler manages a Selector, SocketChannel, and RequestHandler implementation. At the point that the run method is invoked, the Selector with which the (socket) Channel has been registered has notified us that the socket has data to read or write.

The bulk of the complexity in this class surrounds partial reads and writes, as well as determining when all the data needed for the request has been read.

See Also:
RequestHandler

Field Summary
 
Fields inherited from class voldemort.common.nio.SelectorManagerWorker
createTimestamp, inputStream, isClosed, logger, outputStream, resizeThreshold, selector, socketBufferSize, socketChannel
 
Constructor Summary
AsyncRequestHandler(java.nio.channels.Selector selector, java.nio.channels.SocketChannel socketChannel, RequestHandlerFactory requestHandlerFactory, int socketBufferSize, NioSelectorManagerStats nioStats)
           
 
Method Summary
 void close()
           
protected  void read(java.nio.channels.SelectionKey selectionKey)
           
protected  void write(java.nio.channels.SelectionKey selectionKey)
           
 
Methods inherited from class voldemort.common.nio.SelectorManagerWorker
closeInternal, getCreateTimestamp, handleIncompleteRequest, isClosed, prepForWrite, run, traceInputBufferState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncRequestHandler

public AsyncRequestHandler(java.nio.channels.Selector selector,
                           java.nio.channels.SocketChannel socketChannel,
                           RequestHandlerFactory requestHandlerFactory,
                           int socketBufferSize,
                           NioSelectorManagerStats nioStats)
Method Detail

read

protected void read(java.nio.channels.SelectionKey selectionKey)
             throws java.io.IOException
Specified by:
read in class SelectorManagerWorker
Throws:
java.io.IOException

write

protected void write(java.nio.channels.SelectionKey selectionKey)
              throws java.io.IOException
Specified by:
write in class SelectorManagerWorker
Throws:
java.io.IOException

close

public void close()
Overrides:
close in class SelectorManagerWorker


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu