voldemort.store.socket.clientrequest
Class ClientRequestExecutorPool

java.lang.Object
  extended by voldemort.store.socket.clientrequest.ClientRequestExecutorPool
All Implemented Interfaces:
SocketStoreFactory

public class ClientRequestExecutorPool
extends java.lang.Object
implements SocketStoreFactory

A pool of ClientRequestExecutor keyed off the SocketDestination. This is a wrapper around KeyedResourcePool that translates exceptions as well as providing some JMX access.

Upon successful construction of this object, a new Thread is started. It is terminated upon calling close().


Constructor Summary
ClientRequestExecutorPool(int maxConnectionsPerNode, int connectionTimeoutMs, int soTimeoutMs, int socketBufferSize)
           
ClientRequestExecutorPool(int selectors, int maxConnectionsPerNode, int connectionTimeoutMs, int soTimeoutMs, int socketBufferSize, boolean socketKeepAlive)
           
 
Method Summary
 void checkin(SocketDestination destination, ClientRequestExecutor clientRequestExecutor)
          Check the socket back into the pool.
 ClientRequestExecutor checkout(SocketDestination destination)
          Checkout a socket from the pool
 void close()
          Close the socket pool
 void close(SocketDestination destination)
          This closes the resources for a specific host, usually in response to an error in communicating with that host.
 SocketStore create(java.lang.String storeName, java.lang.String hostName, int port, RequestFormatType requestFormatType, RequestRoutingType requestRoutingType)
          Creates a new SocketStore using the specified store name, remote server, format type and routing type.
 double getAvgWaitTimeMs()
           
 ClientRequestExecutorFactory getFactory()
           
 int getNumberOfActiveConnections()
           
 int getNumberOfCheckedInConnections()
           
 int getNumberSocketsCreated()
           
 int getNumberSocketsDestroyed()
           
 void setMonitoringInterval(int count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRequestExecutorPool

public ClientRequestExecutorPool(int selectors,
                                 int maxConnectionsPerNode,
                                 int connectionTimeoutMs,
                                 int soTimeoutMs,
                                 int socketBufferSize,
                                 boolean socketKeepAlive)

ClientRequestExecutorPool

public ClientRequestExecutorPool(int maxConnectionsPerNode,
                                 int connectionTimeoutMs,
                                 int soTimeoutMs,
                                 int socketBufferSize)
Method Detail

getFactory

public ClientRequestExecutorFactory getFactory()

create

public SocketStore create(java.lang.String storeName,
                          java.lang.String hostName,
                          int port,
                          RequestFormatType requestFormatType,
                          RequestRoutingType requestRoutingType)
Description copied from interface: SocketStoreFactory
Creates a new SocketStore using the specified store name, remote server, format type and routing type.

Specified by:
create in interface SocketStoreFactory
Parameters:
storeName - Name of store
hostName - Host name of remote Voldemort node
port - Port on which hostName is listening
requestFormatType - RequestFormatType
requestRoutingType - RequestRoutingType
Returns:
New SocketStore

checkout

public ClientRequestExecutor checkout(SocketDestination destination)
Checkout a socket from the pool

Parameters:
destination - The socket destination you want to connect to
Returns:
The socket

checkin

public void checkin(SocketDestination destination,
                    ClientRequestExecutor clientRequestExecutor)
Check the socket back into the pool.

Parameters:
destination - The socket destination of the socket
clientRequestExecutor - The request executor wrapper

close

public void close(SocketDestination destination)
Description copied from interface: SocketStoreFactory
This closes the resources for a specific host, usually in response to an error in communicating with that host.

Specified by:
close in interface SocketStoreFactory
Parameters:
destination - SocketDestination representing the host name, port, etc. for a remote host

close

public void close()
Close the socket pool

Specified by:
close in interface SocketStoreFactory

getNumberSocketsCreated

public int getNumberSocketsCreated()

getNumberSocketsDestroyed

public int getNumberSocketsDestroyed()

getNumberOfActiveConnections

public int getNumberOfActiveConnections()

getNumberOfCheckedInConnections

public int getNumberOfCheckedInConnections()

getAvgWaitTimeMs

public double getAvgWaitTimeMs()

setMonitoringInterval

public void setMonitoringInterval(int count)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao