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 enumType of node locator to use.static enumType of protocol to use for connections. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthDescriptorprotected longprotected ClientModeprotected MetricCollectorprotected ExecutorServiceprotected FailureModeprotected HashAlgorithmprotected Stringprotected Collection<ConnectionObserver> protected booleanprotected booleanprotected ConnectionFactoryBuilder.Locatorprotected longprotected MetricTypeprotected OperationFactoryprotected OperationQueueFactoryprotected longprotected longprotected intprotected OperationQueueFactoryprotected booleanprotected booleanprotected SSLContextprotected intprotected Transcoder<Object> protected booleanprotected 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.setClientMode(ClientMode clientMode) 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.setHostnameForTlsVerification(String hostnameForTlsVerification) Set hostname for TLS hostname verification.Set the initial connection observers (will observe initial connection).setKeepAlive(boolean on) setListenerExecutorService(ExecutorService executorService) Set a customExecutorServiceto 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.setSkipTlsHostnameVerification(boolean skipTlsHostnameVerification) Set skipping hostname verification status (default to false).setSSLContext(SSLContext sslContext) Set SSLContext for TLS connections usage.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
-
clientMode
-
failureMode
-
initialObservers
-
opFact
-
locator
-
opTimeout
protected long opTimeout -
isDaemon
protected boolean isDaemon -
shouldOptimize
protected boolean shouldOptimize -
useNagle
protected boolean useNagle -
keepAlive
protected boolean keepAlive -
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 -
sslContext
-
hostnameForTlsVerification
-
skipTlsHostnameVerification
protected boolean skipTlsHostnameVerification
-
-
Constructor Details
-
ConnectionFactoryBuilder
public ConnectionFactoryBuilder()Set the operation queue factory. -
ConnectionFactoryBuilder
-
-
Method Details
-
setClientMode
- Parameters:
clientMode-- Returns:
-
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. -
setKeepAlive
-
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. -
setSSLContext
Set SSLContext for TLS connections usage. -
setHostnameForTlsVerification
Set hostname for TLS hostname verification. -
setSkipTlsHostnameVerification
Set skipping hostname verification status (default to false). -
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 customExecutorServiceto execute the listener callbacks. Note that if a customExecutorServiceis 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.
-