voldemort.store.socket.clientrequest
Class ClientRequestExecutor

java.lang.Object
  extended by voldemort.common.nio.SelectorManagerWorker
      extended by voldemort.store.socket.clientrequest.ClientRequestExecutor
All Implemented Interfaces:
java.lang.Runnable

public class ClientRequestExecutor
extends SelectorManagerWorker

ClientRequestExecutor represents a persistent link between a client and server and is used by the ClientRequestExecutorPool to execute requests for the client. Instances are maintained in a pool by ClientRequestExecutorPool using a checkout/checkin pattern. When an instance is checked out, the calling code has exclusive access to that instance. Then the request can be executed.

See Also:
SelectorManagerWorker, ClientRequestExecutorPool

Field Summary
 
Fields inherited from class voldemort.common.nio.SelectorManagerWorker
createTimestamp, inputStream, isClosed, logger, outputStream, resizeThreshold, selector, socketBufferSize, socketChannel
 
Constructor Summary
ClientRequestExecutor(java.nio.channels.Selector selector, java.nio.channels.SocketChannel socketChannel, int socketBufferSize)
           
 
Method Summary
 void addClientRequest(ClientRequest<?> clientRequest)
           
 void addClientRequest(ClientRequest<?> clientRequest, long timeoutMs)
           
 void addClientRequest(ClientRequest<?> clientRequest, long timeoutMs, long elapsedNs)
           
 boolean checkTimeout()
           
 void close()
           
 java.nio.channels.SocketChannel getSocketChannel()
           
 boolean isValid()
           
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

ClientRequestExecutor

public ClientRequestExecutor(java.nio.channels.Selector selector,
                             java.nio.channels.SocketChannel socketChannel,
                             int socketBufferSize)
Method Detail

getSocketChannel

public java.nio.channels.SocketChannel getSocketChannel()

isValid

public boolean isValid()

checkTimeout

public boolean checkTimeout()

addClientRequest

public void addClientRequest(ClientRequest<?> clientRequest)

addClientRequest

public void addClientRequest(ClientRequest<?> clientRequest,
                             long timeoutMs)

addClientRequest

public void addClientRequest(ClientRequest<?> clientRequest,
                             long timeoutMs,
                             long elapsedNs)

close

public void close()
Overrides:
close in class SelectorManagerWorker

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


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