Package net.spy.memcached
Class ConnectionFactoryBuilder
java.lang.Object
net.spy.memcached.ConnectionFactoryBuilder
Builder for more easily configuring a ConnectionFactory.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Type of node locator to use.static enum
Type of protocol to use for connections. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthDescriptor
protected long
protected MetricCollector
protected ExecutorService
protected FailureMode
protected HashAlgorithm
protected Collection
<ConnectionObserver> protected boolean
protected ConnectionFactoryBuilder.Locator
protected long
protected MetricType
protected OperationFactory
protected OperationQueueFactory
protected long
protected long
protected int
protected OperationQueueFactory
protected boolean
protected int
protected Transcoder
<Object> protected boolean
protected OperationQueueFactory
-
Constructor Summary
ConstructorsConstructorDescriptionSet the operation queue factory. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Get the ConnectionFactory set up with the provided parameters.Set the auth descriptor to enable authentication on new connections.setAuthWaitTime
(long authWaitTime) Set a custom wait time for the authentication on connect/reconnect.setDaemon
(boolean d) Set the daemon state of the IO thread (defaults to true).setEnableMetrics
(MetricType type) Enable or disable metric collection.Set the failure mode.Set the hash algorithm.Set the initial connection observers (will observe initial connection).setListenerExecutorService
(ExecutorService executorService) Set a customExecutorService
to execute the listener callbacks.Set the locator type.setMaxReconnectDelay
(long to) Set the maximum reconnect delay.setMetricCollector
(MetricCollector collector) Set a customMetricCollector
.Set the operation factory.setOpQueueMaxBlockTime
(long t) Set the maximum amount of time (in milliseconds) a client is willing to wait for space to become available in an output queue.setOpTimeout
(long t) Set the default operation timeout in milliseconds.Convenience method to specify the protocol to use.setReadBufferSize
(int to) Set the read buffer size.Set the read queue factory.setShouldOptimize
(boolean o) Set to false if the default operation optimization is not desirable.setTimeoutExceptionThreshold
(int to) Set the maximum timeout exception threshold.Set the default transcoder.setUseNagleAlgorithm
(boolean to) Set to true if you'd like to enable the Nagle algorithm.Set the write queue factory.
-
Field Details
-
opQueueFactory
-
readQueueFactory
-
writeQueueFactory
-
transcoder
-
failureMode
-
initialObservers
-
opFact
-
locator
-
opTimeout
protected long opTimeout -
isDaemon
protected boolean isDaemon -
shouldOptimize
protected boolean shouldOptimize -
useNagle
protected boolean useNagle -
maxReconnectDelay
protected long maxReconnectDelay -
readBufSize
protected int readBufSize -
hashAlg
-
authDescriptor
-
opQueueMaxBlockTime
protected long opQueueMaxBlockTime -
timeoutExceptionThreshold
protected int timeoutExceptionThreshold -
metricType
-
collector
-
executorService
-
authWaitTime
protected long authWaitTime
-
-
Constructor Details
-
ConnectionFactoryBuilder
public ConnectionFactoryBuilder()Set the operation queue factory. -
ConnectionFactoryBuilder
-
-
Method Details
-
setOpQueueFactory
-
setReadOpQueueFactory
Set the read queue factory. -
setWriteOpQueueFactory
Set the write queue factory. -
setOpQueueMaxBlockTime
Set the maximum amount of time (in milliseconds) a client is willing to wait for space to become available in an output queue. -
setTranscoder
Set the default transcoder. -
setFailureMode
Set the failure mode. -
setInitialObservers
Set the initial connection observers (will observe initial connection). -
setOpFact
Set the operation factory. Note that the operation factory is used to also imply the type of nodes to create.- See Also:
-
setOpTimeout
Set the default operation timeout in milliseconds. -
setDaemon
Set the daemon state of the IO thread (defaults to true). -
setShouldOptimize
Set to false if the default operation optimization is not desirable. -
setReadBufferSize
Set the read buffer size. -
setHashAlg
Set the hash algorithm. -
setUseNagleAlgorithm
Set to true if you'd like to enable the Nagle algorithm. -
setProtocol
Convenience method to specify the protocol to use. -
setLocatorType
Set the locator type. -
setMaxReconnectDelay
Set the maximum reconnect delay. -
setAuthDescriptor
Set the auth descriptor to enable authentication on new connections. -
setTimeoutExceptionThreshold
Set the maximum timeout exception threshold. -
setEnableMetrics
Enable or disable metric collection.- Parameters:
type
- the metric type to use (or disable).
-
setMetricCollector
Set a customMetricCollector
.- Parameters:
collector
- the metric collector to use.
-
setListenerExecutorService
Set a customExecutorService
to execute the listener callbacks. Note that if a customExecutorService
is passed in, it also needs to be properly shut down by the caller. The library itself treats it as a outside managed resource. Therefore, also make sure to not shut it down before all instances that use it are shut down.- Parameters:
executorService
- the ExecutorService to use.
-
setAuthWaitTime
Set a custom wait time for the authentication on connect/reconnect.- Parameters:
authWaitTime
- the time in milliseconds.
-
build
Get the ConnectionFactory set up with the provided parameters.
-