net.spy.memcached
Class KetamaConnectionFactory

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by net.spy.memcached.DefaultConnectionFactory
          extended by net.spy.memcached.KetamaConnectionFactory
All Implemented Interfaces:
ConnectionFactory

public class KetamaConnectionFactory
extends DefaultConnectionFactory

ConnectionFactory instance that sets up a ketama compatible connection.

This implementation piggy-backs on the functionality of the DefaultConnectionFactory in terms of connections and queue handling. Where it differs is that it uses both the KetamaNodeLocator and the HashAlgorithm.KETAMA_HASH to provide consistent node hashing.

See Also:
RJ's blog post

Field Summary
 
Fields inherited from class net.spy.memcached.DefaultConnectionFactory
DEFAULT_FAILURE_MODE, DEFAULT_HASH, DEFAULT_MAX_RECONNECT_DELAY, DEFAULT_OP_QUEUE_LEN, DEFAULT_OPERATION_TIMEOUT, DEFAULT_READ_BUFFER_SIZE
 
Constructor Summary
KetamaConnectionFactory()
          Create a KetamaConnectionFactory with the default parameters.
KetamaConnectionFactory(int qLen, int bufSize)
          Create a KetamaConnectionFactory with the given maximum operation queue length, and the given read buffer size.
 
Method Summary
 NodeLocator createLocator(List<MemcachedNode> nodes)
          Create a NodeLocator instance for the given list of nodes.
 
Methods inherited from class net.spy.memcached.DefaultConnectionFactory
createConnection, createMemcachedNode, createOperationQueue, createReadOperationQueue, createWriteOperationQueue, getDefaultTranscoder, getFailureMode, getHashAlg, getInitialObservers, getMaxReconnectDelay, getOperationFactory, getOperationTimeout, getOpQueueLen, getReadBufSize, isDaemon, shouldOptimize, useNagleAlgorithm
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KetamaConnectionFactory

public KetamaConnectionFactory(int qLen,
                               int bufSize)
Create a KetamaConnectionFactory with the given maximum operation queue length, and the given read buffer size.


KetamaConnectionFactory

public KetamaConnectionFactory()
Create a KetamaConnectionFactory with the default parameters.

Method Detail

createLocator

public NodeLocator createLocator(List<MemcachedNode> nodes)
Description copied from interface: ConnectionFactory
Create a NodeLocator instance for the given list of nodes.

Specified by:
createLocator in interface ConnectionFactory
Overrides:
createLocator in class DefaultConnectionFactory