net.spy.memcached
Class ConnectionFactoryBuilder

java.lang.Object
  extended by net.spy.memcached.ConnectionFactoryBuilder

public class ConnectionFactoryBuilder
extends java.lang.Object

Builder for more easily configuring a ConnectionFactory.


Nested Class Summary
static class ConnectionFactoryBuilder.Locator
          Type of node locator to use.
static class ConnectionFactoryBuilder.Protocol
          Type of protocol to use for connections.
 
Field Summary
protected  AuthDescriptor authDescriptor
           
protected  FailureMode failureMode
           
protected  HashAlgorithm hashAlg
           
protected  java.util.Collection<ConnectionObserver> initialObservers
           
protected  boolean isDaemon
           
protected  ConnectionFactoryBuilder.Locator locator
           
protected  long maxReconnectDelay
           
protected  OperationFactory opFact
           
protected  OperationQueueFactory opQueueFactory
           
protected  long opQueueMaxBlockTime
           
protected  long opTimeout
           
protected  int readBufSize
           
protected  OperationQueueFactory readQueueFactory
           
protected  boolean shouldOptimize
           
protected  int timeoutExceptionThreshold
           
protected  Transcoder<java.lang.Object> transcoder
           
protected  boolean useNagle
           
protected  OperationQueueFactory writeQueueFactory
           
 
Constructor Summary
ConnectionFactoryBuilder()
          Set the operation queue factory.
ConnectionFactoryBuilder(ConnectionFactory cf)
           
 
Method Summary
 ConnectionFactory build()
          Get the ConnectionFactory set up with the provided parameters.
 ConnectionFactoryBuilder setAuthDescriptor(AuthDescriptor to)
          Set the auth descriptor to enable authentication on new connections.
 ConnectionFactoryBuilder setDaemon(boolean d)
          Set the daemon state of the IO thread (defaults to true).
 ConnectionFactoryBuilder setFailureMode(FailureMode fm)
          Set the failure mode.
 ConnectionFactoryBuilder setHashAlg(HashAlgorithm to)
          Set the hash algorithm.
 ConnectionFactoryBuilder setInitialObservers(java.util.Collection<ConnectionObserver> obs)
          Set the initial connection observers (will observe initial connection).
 ConnectionFactoryBuilder setLocatorType(ConnectionFactoryBuilder.Locator l)
          Set the locator type.
 ConnectionFactoryBuilder setMaxReconnectDelay(long to)
          Set the maximum reconnect delay.
 ConnectionFactoryBuilder setOpFact(OperationFactory f)
          Set the operation factory.
 ConnectionFactoryBuilder setOpQueueFactory(OperationQueueFactory q)
           
 ConnectionFactoryBuilder 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.
 ConnectionFactoryBuilder setOpTimeout(long t)
          Set the default operation timeout in milliseconds.
 ConnectionFactoryBuilder setProtocol(ConnectionFactoryBuilder.Protocol prot)
          Convenience method to specify the protocol to use.
 ConnectionFactoryBuilder setReadBufferSize(int to)
          Set the read buffer size.
 ConnectionFactoryBuilder setReadOpQueueFactory(OperationQueueFactory q)
          Set the read queue factory.
 ConnectionFactoryBuilder setShouldOptimize(boolean o)
          Set to false if the default operation optimization is not desirable.
 ConnectionFactoryBuilder setTimeoutExceptionThreshold(int to)
          Set the maximum timeout exception threshold.
 ConnectionFactoryBuilder setTranscoder(Transcoder<java.lang.Object> t)
          Set the default transcoder.
 ConnectionFactoryBuilder setUseNagleAlgorithm(boolean to)
          Set to true if you'd like to enable the Nagle algorithm.
 ConnectionFactoryBuilder setWriteOpQueueFactory(OperationQueueFactory q)
          Set the write queue factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opQueueFactory

protected OperationQueueFactory opQueueFactory

readQueueFactory

protected OperationQueueFactory readQueueFactory

writeQueueFactory

protected OperationQueueFactory writeQueueFactory

transcoder

protected Transcoder<java.lang.Object> transcoder

failureMode

protected FailureMode failureMode

initialObservers

protected java.util.Collection<ConnectionObserver> initialObservers

opFact

protected OperationFactory opFact

locator

protected ConnectionFactoryBuilder.Locator 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

protected HashAlgorithm hashAlg

authDescriptor

protected AuthDescriptor authDescriptor

opQueueMaxBlockTime

protected long opQueueMaxBlockTime

timeoutExceptionThreshold

protected int timeoutExceptionThreshold
Constructor Detail

ConnectionFactoryBuilder

public ConnectionFactoryBuilder()
Set the operation queue factory.


ConnectionFactoryBuilder

public ConnectionFactoryBuilder(ConnectionFactory cf)
Method Detail

setOpQueueFactory

public ConnectionFactoryBuilder setOpQueueFactory(OperationQueueFactory q)

setReadOpQueueFactory

public ConnectionFactoryBuilder setReadOpQueueFactory(OperationQueueFactory q)
Set the read queue factory.


setWriteOpQueueFactory

public ConnectionFactoryBuilder setWriteOpQueueFactory(OperationQueueFactory q)
Set the write queue factory.


setOpQueueMaxBlockTime

public ConnectionFactoryBuilder 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.


setTranscoder

public ConnectionFactoryBuilder setTranscoder(Transcoder<java.lang.Object> t)
Set the default transcoder.


setFailureMode

public ConnectionFactoryBuilder setFailureMode(FailureMode fm)
Set the failure mode.


setInitialObservers

public ConnectionFactoryBuilder setInitialObservers(java.util.Collection<ConnectionObserver> obs)
Set the initial connection observers (will observe initial connection).


setOpFact

public ConnectionFactoryBuilder setOpFact(OperationFactory f)
Set the operation factory. Note that the operation factory is used to also imply the type of nodes to create.

See Also:
MemcachedNode

setOpTimeout

public ConnectionFactoryBuilder setOpTimeout(long t)
Set the default operation timeout in milliseconds.


setDaemon

public ConnectionFactoryBuilder setDaemon(boolean d)
Set the daemon state of the IO thread (defaults to true).


setShouldOptimize

public ConnectionFactoryBuilder setShouldOptimize(boolean o)
Set to false if the default operation optimization is not desirable.


setReadBufferSize

public ConnectionFactoryBuilder setReadBufferSize(int to)
Set the read buffer size.


setHashAlg

public ConnectionFactoryBuilder setHashAlg(HashAlgorithm to)
Set the hash algorithm.


setUseNagleAlgorithm

public ConnectionFactoryBuilder setUseNagleAlgorithm(boolean to)
Set to true if you'd like to enable the Nagle algorithm.


setProtocol

public ConnectionFactoryBuilder setProtocol(ConnectionFactoryBuilder.Protocol prot)
Convenience method to specify the protocol to use.


setLocatorType

public ConnectionFactoryBuilder setLocatorType(ConnectionFactoryBuilder.Locator l)
Set the locator type.


setMaxReconnectDelay

public ConnectionFactoryBuilder setMaxReconnectDelay(long to)
Set the maximum reconnect delay.


setAuthDescriptor

public ConnectionFactoryBuilder setAuthDescriptor(AuthDescriptor to)
Set the auth descriptor to enable authentication on new connections.


setTimeoutExceptionThreshold

public ConnectionFactoryBuilder setTimeoutExceptionThreshold(int to)
Set the maximum timeout exception threshold.


build

public ConnectionFactory build()
Get the ConnectionFactory set up with the provided parameters.



Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.