voldemort.store.socket.clientrequest
Class ClientRequestExecutorFactory

java.lang.Object
  extended by voldemort.store.socket.clientrequest.ClientRequestExecutorFactory
All Implemented Interfaces:
ResourceFactory<SocketDestination,ClientRequestExecutor>

public class ClientRequestExecutorFactory
extends java.lang.Object
implements ResourceFactory<SocketDestination,ClientRequestExecutor>

A Factory for creating ClientRequestExecutor instances.


Constructor Summary
ClientRequestExecutorFactory(int selectors, int connectTimeoutMs, int soTimeoutMs, int socketBufferSize, boolean socketKeepAlive, ClientSocketStats stats)
           
 
Method Summary
 void close()
           
 ClientRequestExecutor create(SocketDestination dest)
          Create a ClientRequestExecutor for the given SocketDestination.
 void destroy(SocketDestination dest, ClientRequestExecutor clientRequestExecutor)
          Close the ClientRequestExecutor.
 int getNumberCreated()
           
 int getNumberDestroyed()
           
 int getTimeout()
           
 void setLastClosedTimestamp(SocketDestination socketDestination)
          Assigns the last closed timestamp based on the current time in nanoseconds.
 boolean validate(SocketDestination dest, ClientRequestExecutor clientRequestExecutor)
          Check that the given resource is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRequestExecutorFactory

public ClientRequestExecutorFactory(int selectors,
                                    int connectTimeoutMs,
                                    int soTimeoutMs,
                                    int socketBufferSize,
                                    boolean socketKeepAlive,
                                    ClientSocketStats stats)
Method Detail

destroy

public void destroy(SocketDestination dest,
                    ClientRequestExecutor clientRequestExecutor)
             throws java.lang.Exception
Close the ClientRequestExecutor.

Specified by:
destroy in interface ResourceFactory<SocketDestination,ClientRequestExecutor>
Parameters:
dest - The key of the resource
clientRequestExecutor - The resource
Throws:
java.lang.Exception

create

public ClientRequestExecutor create(SocketDestination dest)
                             throws java.lang.Exception
Create a ClientRequestExecutor for the given SocketDestination.

Specified by:
create in interface ResourceFactory<SocketDestination,ClientRequestExecutor>
Parameters:
dest - SocketDestination
Returns:
The created resource
Throws:
java.lang.Exception

validate

public boolean validate(SocketDestination dest,
                        ClientRequestExecutor clientRequestExecutor)
Description copied from interface: ResourceFactory
Check that the given resource is valid. This is called once on every checkout, so that the checked out resource is guaranteed to be valid (though it could immediately become invalid).

Specified by:
validate in interface ResourceFactory<SocketDestination,ClientRequestExecutor>
Parameters:
dest - The key of the resource
clientRequestExecutor - The resource
Returns:
True iff the resource is valid

getTimeout

public int getTimeout()

getNumberCreated

public int getNumberCreated()

getNumberDestroyed

public int getNumberDestroyed()

close

public void close()
Specified by:
close in interface ResourceFactory<SocketDestination,ClientRequestExecutor>

setLastClosedTimestamp

public void setLastClosedTimestamp(SocketDestination socketDestination)
Assigns the last closed timestamp based on the current time in nanoseconds.

This value starts off as 0 and is updated via this method each time the node is marked as unavailable.



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