net.spy.memcached
Class ConnectionFactoryBuilder

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

public class ConnectionFactoryBuilder
extends 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.
 
Constructor Summary
ConnectionFactoryBuilder()
           
 
Method Summary
 ConnectionFactory build()
          Get the ConnectionFactory set up with the provided parameters.
 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(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)
          Set the operation queue factory.
 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 setTranscoder(Transcoder<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
 

Constructor Detail

ConnectionFactoryBuilder

public ConnectionFactoryBuilder()
Method Detail

setOpQueueFactory

public ConnectionFactoryBuilder setOpQueueFactory(OperationQueueFactory q)
Set the operation queue factory.


setReadOpQueueFactory

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


setWriteOpQueueFactory

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


setTranscoder

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


setFailureMode

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


setInitialObservers

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


build

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