All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.spy.memcached.KetamaConnectionFactory Maven / Gradle / Ivy

The newest version!
package net.spy.memcached;

import java.util.List;

/**
 * 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 RJ's blog post */ public class KetamaConnectionFactory extends DefaultConnectionFactory { /** * Create a KetamaConnectionFactory with the given maximum operation * queue length, and the given read buffer size. * * @param opQueueMaxBlockTime the maximum time to block waiting for op * queue operations to complete, in milliseconds */ public KetamaConnectionFactory(int qLen, int bufSize, long opQueueMaxBlockTime) { super(qLen, bufSize, HashAlgorithm.KETAMA_HASH); } /** * Create a KetamaConnectionFactory with the default parameters. */ public KetamaConnectionFactory() { this(DEFAULT_OP_QUEUE_LEN, DEFAULT_READ_BUFFER_SIZE, DEFAULT_OP_QUEUE_MAX_BLOCK_TIME); } @Override public NodeLocator createLocator(List nodes) { return new KetamaNodeLocator(nodes, getHashAlg()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy