voldemort.client
Class ClientConfig

java.lang.Object
  extended by voldemort.client.ClientConfig

public class ClientConfig
extends java.lang.Object

A configuration object that holds configuration parameters for the client.


Field Summary
static java.lang.String BOOTSTRAP_URLS_PROPERTY
           
static java.lang.String CONNECTION_TIMEOUT_MS_PROPERTY
           
static java.lang.String ENABLE_JMX_PROPERTY
           
static java.lang.String FAILUREDETECTOR_ASYNCRECOVERY_INTERVAL_PROPERTY
           
static java.lang.String FAILUREDETECTOR_BANNAGE_PERIOD_PROPERTY
           
static java.lang.String FAILUREDETECTOR_CATASTROPHIC_ERROR_TYPES_PROPERTY
           
static java.lang.String FAILUREDETECTOR_IMPLEMENTATION_PROPERTY
           
static java.lang.String FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD_PROPERTY
           
static java.lang.String FAILUREDETECTOR_THRESHOLD_COUNTMINIMUM_PROPERTY
           
static java.lang.String FAILUREDETECTOR_THRESHOLD_INTERVAL_PROPERTY
           
static java.lang.String FAILUREDETECTOR_THRESHOLD_PROPERTY
           
static java.lang.String MAX_BOOTSTRAP_RETRIES
           
static java.lang.String MAX_CONNECTIONS_PER_NODE_PROPERTY
           
static java.lang.String MAX_QUEUED_REQUESTS_PROPERTY
           
static java.lang.String MAX_THREADS_PROPERTY
           
static java.lang.String MAX_TOTAL_CONNECTIONS_PROPERTY
           
static java.lang.String NODE_BANNAGE_MS_PROPERTY
           
static java.lang.String REQUEST_FORMAT_PROPERTY
           
static java.lang.String ROUTING_TIMEOUT_MS_PROPERTY
           
static java.lang.String SERIALIZER_FACTORY_CLASS_PROPERTY
           
static java.lang.String SOCKET_BUFFER_SIZE_PROPERTY
           
static java.lang.String SOCKET_KEEPALIVE_PROPERTY
           
static java.lang.String SOCKET_TIMEOUT_MS_PROPERTY
           
static java.lang.String THREAD_IDLE_MS_PROPERTY
           
 
Constructor Summary
ClientConfig()
           
ClientConfig(java.util.Properties properties)
          Initiate the client config from a set of properties.
 
Method Summary
 java.lang.String[] getBootstrapUrls()
           
 int getConnectionTimeout(java.util.concurrent.TimeUnit unit)
           
 long getFailureDetectorAsyncRecoveryInterval()
           
 long getFailureDetectorBannagePeriod()
           
 java.util.List<java.lang.String> getFailureDetectorCatastrophicErrorTypes()
           
 java.lang.String getFailureDetectorImplementation()
           
 long getFailureDetectorRequestLengthThreshold()
           
 int getFailureDetectorThreshold()
           
 int getFailureDetectorThresholdCountMinimum()
           
 long getFailureDetectorThresholdInterval()
           
 int getMaxBootstrapRetries()
           
 int getMaxConnectionsPerNode()
           
 int getMaxQueuedRequests()
           
 int getMaxThreads()
           
 int getMaxTotalConnections()
           
 int getNodeBannagePeriod(java.util.concurrent.TimeUnit unit)
          Deprecated. Use getFailureDetectorBannagePeriod() instead
 RequestFormatType getRequestFormatType()
           
 RoutingTier getRoutingTier()
           
 int getRoutingTimeout(java.util.concurrent.TimeUnit unit)
           
 SerializerFactory getSerializerFactory()
           
 int getSocketBufferSize()
           
 boolean getSocketKeepAlive()
           
 int getSocketTimeout(java.util.concurrent.TimeUnit unit)
           
 int getThreadIdleTime(java.util.concurrent.TimeUnit unit)
           
 boolean isJmxEnabled()
           
 ClientConfig setBootstrapUrls(java.util.List<java.lang.String> bootstrapUrls)
          Set the bootstrap urls from which to attempt a connection
 ClientConfig setBootstrapUrls(java.lang.String... bootstrapUrls)
          Set the bootstrap urls from which to attempt a connection
 ClientConfig setConnectionTimeout(int connectionTimeout, java.util.concurrent.TimeUnit unit)
          Set the maximum allowable time to block waiting for a free connection
 ClientConfig setEnableJmx(boolean enableJmx)
          Enable JMX monitoring of the clients?
 ClientConfig setFailureDetectorAsyncRecoveryInterval(long failureDetectorAsyncRecoveryInterval)
           
 ClientConfig setFailureDetectorBannagePeriod(long failureDetectorBannagePeriod)
           
 ClientConfig setFailureDetectorCatastrophicErrorTypes(java.util.List<java.lang.String> failureDetectorCatastrophicErrorTypes)
           
 ClientConfig setFailureDetectorImplementation(java.lang.String failureDetectorImplementation)
           
 ClientConfig setFailureDetectorRequestLengthThreshold(long failureDetectorRequestLengthThreshold)
           
 ClientConfig setFailureDetectorThreshold(int failureDetectorThreshold)
           
 ClientConfig setFailureDetectorThresholdCountMinimum(int failureDetectorThresholdCountMinimum)
           
 ClientConfig setFailureDetectorThresholdInterval(long failureDetectorThresholdInterval)
           
 ClientConfig setMaxBootstrapRetries(int maxBootstrapRetries)
          If we are unable to bootstrap, how many times should we re-try?
 ClientConfig setMaxConnectionsPerNode(int maxConnectionsPerNode)
          Set the maximum number of connection allowed to each voldemort node
 ClientConfig setMaxQueuedRequests(int maxQueuedRequests)
          Set the maximum number of queued node operations before client actions will be blocked
 ClientConfig setMaxThreads(int maxThreads)
          Set the maximum number of client threads
 ClientConfig setMaxTotalConnections(int maxTotalConnections)
          Set the maximum number of connections allowed to all voldemort nodes
 ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, java.util.concurrent.TimeUnit unit)
          Deprecated. Use setFailureDetectorBannagePeriod(long) instead
 ClientConfig setRequestFormatType(RequestFormatType requestFormatType)
          Set the request format type used for network communications (for example protocol buffers)
 ClientConfig setRoutingTier(RoutingTier routingTier)
          Set the tier at which routing occurs.
 ClientConfig setRoutingTimeout(int routingTimeout, java.util.concurrent.TimeUnit unit)
          Set the timeout for all blocking operations to complete on all nodes.
 ClientConfig setSerializerFactory(SerializerFactory serializerFactory)
          Set the SerializerFactory used to serialize and deserialize values
 ClientConfig setSocketBufferSize(int socketBufferSize)
          Set the size of the socket buffer to use for both socket reads and socket writes
 ClientConfig setSocketKeepAlive(boolean socketKeepAlive)
           
 ClientConfig setSocketTimeout(int socketTimeout, java.util.concurrent.TimeUnit unit)
          Set the SO_TIMEOUT for the socket if using HTTP or socket based network communication.
 ClientConfig setThreadIdleTime(long threadIdleTime, java.util.concurrent.TimeUnit unit)
          The amount of time to keep an idle client thread alive
 int toInt(long l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CONNECTIONS_PER_NODE_PROPERTY

public static final java.lang.String MAX_CONNECTIONS_PER_NODE_PROPERTY
See Also:
Constant Field Values

MAX_TOTAL_CONNECTIONS_PROPERTY

public static final java.lang.String MAX_TOTAL_CONNECTIONS_PROPERTY
See Also:
Constant Field Values

MAX_THREADS_PROPERTY

public static final java.lang.String MAX_THREADS_PROPERTY
See Also:
Constant Field Values

MAX_QUEUED_REQUESTS_PROPERTY

public static final java.lang.String MAX_QUEUED_REQUESTS_PROPERTY
See Also:
Constant Field Values

THREAD_IDLE_MS_PROPERTY

public static final java.lang.String THREAD_IDLE_MS_PROPERTY
See Also:
Constant Field Values

CONNECTION_TIMEOUT_MS_PROPERTY

public static final java.lang.String CONNECTION_TIMEOUT_MS_PROPERTY
See Also:
Constant Field Values

SOCKET_TIMEOUT_MS_PROPERTY

public static final java.lang.String SOCKET_TIMEOUT_MS_PROPERTY
See Also:
Constant Field Values

SOCKET_KEEPALIVE_PROPERTY

public static final java.lang.String SOCKET_KEEPALIVE_PROPERTY
See Also:
Constant Field Values

ROUTING_TIMEOUT_MS_PROPERTY

public static final java.lang.String ROUTING_TIMEOUT_MS_PROPERTY
See Also:
Constant Field Values

NODE_BANNAGE_MS_PROPERTY

public static final java.lang.String NODE_BANNAGE_MS_PROPERTY
See Also:
Constant Field Values

SOCKET_BUFFER_SIZE_PROPERTY

public static final java.lang.String SOCKET_BUFFER_SIZE_PROPERTY
See Also:
Constant Field Values

SERIALIZER_FACTORY_CLASS_PROPERTY

public static final java.lang.String SERIALIZER_FACTORY_CLASS_PROPERTY
See Also:
Constant Field Values

BOOTSTRAP_URLS_PROPERTY

public static final java.lang.String BOOTSTRAP_URLS_PROPERTY
See Also:
Constant Field Values

REQUEST_FORMAT_PROPERTY

public static final java.lang.String REQUEST_FORMAT_PROPERTY
See Also:
Constant Field Values

ENABLE_JMX_PROPERTY

public static final java.lang.String ENABLE_JMX_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_IMPLEMENTATION_PROPERTY

public static final java.lang.String FAILUREDETECTOR_IMPLEMENTATION_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_BANNAGE_PERIOD_PROPERTY

public static final java.lang.String FAILUREDETECTOR_BANNAGE_PERIOD_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_THRESHOLD_PROPERTY

public static final java.lang.String FAILUREDETECTOR_THRESHOLD_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_THRESHOLD_INTERVAL_PROPERTY

public static final java.lang.String FAILUREDETECTOR_THRESHOLD_INTERVAL_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_THRESHOLD_COUNTMINIMUM_PROPERTY

public static final java.lang.String FAILUREDETECTOR_THRESHOLD_COUNTMINIMUM_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_ASYNCRECOVERY_INTERVAL_PROPERTY

public static final java.lang.String FAILUREDETECTOR_ASYNCRECOVERY_INTERVAL_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_CATASTROPHIC_ERROR_TYPES_PROPERTY

public static final java.lang.String FAILUREDETECTOR_CATASTROPHIC_ERROR_TYPES_PROPERTY
See Also:
Constant Field Values

FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD_PROPERTY

public static final java.lang.String FAILUREDETECTOR_REQUEST_LENGTH_THRESHOLD_PROPERTY
See Also:
Constant Field Values

MAX_BOOTSTRAP_RETRIES

public static final java.lang.String MAX_BOOTSTRAP_RETRIES
See Also:
Constant Field Values
Constructor Detail

ClientConfig

public ClientConfig()

ClientConfig

public ClientConfig(java.util.Properties properties)
Initiate the client config from a set of properties. This is useful for wiring from Spring or for externalizing client properties to a properties file

Parameters:
properties - The properties to use
Method Detail

getMaxConnectionsPerNode

public int getMaxConnectionsPerNode()

setMaxConnectionsPerNode

public ClientConfig setMaxConnectionsPerNode(int maxConnectionsPerNode)
Set the maximum number of connection allowed to each voldemort node

Parameters:
maxConnectionsPerNode - The maximum number of connections

getMaxTotalConnections

public int getMaxTotalConnections()

setMaxTotalConnections

public ClientConfig setMaxTotalConnections(int maxTotalConnections)
Set the maximum number of connections allowed to all voldemort nodes

Parameters:
maxTotalConnections - The maximum total number of connections

getSocketTimeout

public int getSocketTimeout(java.util.concurrent.TimeUnit unit)

setSocketTimeout

public ClientConfig setSocketTimeout(int socketTimeout,
                                     java.util.concurrent.TimeUnit unit)
Set the SO_TIMEOUT for the socket if using HTTP or socket based network communication. This is the maximum amount of time the socket will block waiting for network activity.

Parameters:
socketTimeout - The socket timeout
unit - The time unit of the timeout value

getSocketKeepAlive

public boolean getSocketKeepAlive()

setSocketKeepAlive

public ClientConfig setSocketKeepAlive(boolean socketKeepAlive)

getRoutingTimeout

public int getRoutingTimeout(java.util.concurrent.TimeUnit unit)

setRoutingTimeout

public ClientConfig setRoutingTimeout(int routingTimeout,
                                      java.util.concurrent.TimeUnit unit)
Set the timeout for all blocking operations to complete on all nodes. The number of blocking operations can be configured using the preferred-reads and preferred-writes configuration for the store.

Parameters:
routingTimeout - The timeout for all operations to complete.
unit - The time unit of the timeout value

getNodeBannagePeriod

@Deprecated
public int getNodeBannagePeriod(java.util.concurrent.TimeUnit unit)
Deprecated. Use getFailureDetectorBannagePeriod() instead


setNodeBannagePeriod

@Deprecated
public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod,
                                                    java.util.concurrent.TimeUnit unit)
Deprecated. Use setFailureDetectorBannagePeriod(long) instead

The period of time to ban a node that gives an error on an operation.

Parameters:
nodeBannagePeriod - The period of time to ban the node
unit - The time unit of the given value

getConnectionTimeout

public int getConnectionTimeout(java.util.concurrent.TimeUnit unit)

setConnectionTimeout

public ClientConfig setConnectionTimeout(int connectionTimeout,
                                         java.util.concurrent.TimeUnit unit)
Set the maximum allowable time to block waiting for a free connection

Parameters:
connectionTimeout - The connection timeout
unit - The time unit of the given value

getThreadIdleTime

public int getThreadIdleTime(java.util.concurrent.TimeUnit unit)

setThreadIdleTime

public ClientConfig setThreadIdleTime(long threadIdleTime,
                                      java.util.concurrent.TimeUnit unit)
The amount of time to keep an idle client thread alive

Parameters:
threadIdleTime -

getMaxQueuedRequests

public int getMaxQueuedRequests()

setMaxQueuedRequests

public ClientConfig setMaxQueuedRequests(int maxQueuedRequests)
Set the maximum number of queued node operations before client actions will be blocked

Parameters:
maxQueuedRequests - The maximum number of queued requests

getSocketBufferSize

public int getSocketBufferSize()

setSocketBufferSize

public ClientConfig setSocketBufferSize(int socketBufferSize)
Set the size of the socket buffer to use for both socket reads and socket writes

Parameters:
socketBufferSize - The size of the socket buffer in bytes

getSerializerFactory

public SerializerFactory getSerializerFactory()

setSerializerFactory

public ClientConfig setSerializerFactory(SerializerFactory serializerFactory)
Set the SerializerFactory used to serialize and deserialize values


getBootstrapUrls

public java.lang.String[] getBootstrapUrls()

setBootstrapUrls

public ClientConfig setBootstrapUrls(java.util.List<java.lang.String> bootstrapUrls)
Set the bootstrap urls from which to attempt a connection

Parameters:
bootstrapUrls - The urls to bootstrap from

setBootstrapUrls

public ClientConfig setBootstrapUrls(java.lang.String... bootstrapUrls)
Set the bootstrap urls from which to attempt a connection

Parameters:
bootstrapUrls - The urls to bootstrap from

getRequestFormatType

public RequestFormatType getRequestFormatType()

setRequestFormatType

public ClientConfig setRequestFormatType(RequestFormatType requestFormatType)
Set the request format type used for network communications (for example protocol buffers)

Parameters:
requestFormatType - The type of the network protocol

getRoutingTier

public RoutingTier getRoutingTier()

setRoutingTier

public ClientConfig setRoutingTier(RoutingTier routingTier)
Set the tier at which routing occurs. Client-side routing occurs on the client, and server-side routing on the server. This is not yet used, as the java client only supports client-side routing.

Parameters:
routingTier - The routing tier to use for routing requests

getMaxThreads

public int getMaxThreads()

setMaxThreads

public ClientConfig setMaxThreads(int maxThreads)
Set the maximum number of client threads

Parameters:
maxThreads - The maximum number of client threads

toInt

public int toInt(long l)

isJmxEnabled

public boolean isJmxEnabled()

setEnableJmx

public ClientConfig setEnableJmx(boolean enableJmx)
Enable JMX monitoring of the clients?

Parameters:
enableJmx - If true JMX monitoring of the clients will be enabled

getFailureDetectorImplementation

public java.lang.String getFailureDetectorImplementation()

setFailureDetectorImplementation

public ClientConfig setFailureDetectorImplementation(java.lang.String failureDetectorImplementation)

getFailureDetectorBannagePeriod

public long getFailureDetectorBannagePeriod()

setFailureDetectorBannagePeriod

public ClientConfig setFailureDetectorBannagePeriod(long failureDetectorBannagePeriod)

getFailureDetectorThreshold

public int getFailureDetectorThreshold()

setFailureDetectorThreshold

public ClientConfig setFailureDetectorThreshold(int failureDetectorThreshold)

getFailureDetectorThresholdCountMinimum

public int getFailureDetectorThresholdCountMinimum()

setFailureDetectorThresholdCountMinimum

public ClientConfig setFailureDetectorThresholdCountMinimum(int failureDetectorThresholdCountMinimum)

getFailureDetectorThresholdInterval

public long getFailureDetectorThresholdInterval()

setFailureDetectorThresholdInterval

public ClientConfig setFailureDetectorThresholdInterval(long failureDetectorThresholdInterval)

getFailureDetectorAsyncRecoveryInterval

public long getFailureDetectorAsyncRecoveryInterval()

setFailureDetectorAsyncRecoveryInterval

public ClientConfig setFailureDetectorAsyncRecoveryInterval(long failureDetectorAsyncRecoveryInterval)

getFailureDetectorCatastrophicErrorTypes

public java.util.List<java.lang.String> getFailureDetectorCatastrophicErrorTypes()

setFailureDetectorCatastrophicErrorTypes

public ClientConfig setFailureDetectorCatastrophicErrorTypes(java.util.List<java.lang.String> failureDetectorCatastrophicErrorTypes)

getFailureDetectorRequestLengthThreshold

public long getFailureDetectorRequestLengthThreshold()

setFailureDetectorRequestLengthThreshold

public ClientConfig setFailureDetectorRequestLengthThreshold(long failureDetectorRequestLengthThreshold)

getMaxBootstrapRetries

public int getMaxBootstrapRetries()

setMaxBootstrapRetries

public ClientConfig setMaxBootstrapRetries(int maxBootstrapRetries)
If we are unable to bootstrap, how many times should we re-try?

Parameters:
maxBootstrapRetries - Maximum times to retry bootstrapping (must be >= 1)
Throws:
java.lang.IllegalArgumentException - If maxBootstrapRetries < 1


Jay Kreps