|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.spy.SpyObject
net.spy.memcached.DefaultConnectionFactory
public class DefaultConnectionFactory
Default implementation of ConnectionFactory.
This implementation creates connections where each server worker queue is implemented using an ArrayBlockingQueue. The read queue is automatically configured to be 10% larger than the specified op queue. The write queue is and input queues are the same size.
| Field Summary | |
|---|---|
static int |
DEFAULT_OP_QUEUE_LEN
Maximum length of the operation queue returned by this connection factory. |
static long |
DEFAULT_OPERATION_TIMEOUT
Default operation timeout in milliseconds. |
static int |
DEFAULT_READ_BUFFER_SIZE
The read buffer size for each server connection from this factory. |
| Constructor Summary | |
|---|---|
DefaultConnectionFactory()
Create a DefaultConnectionFactory with the default parameters. |
|
DefaultConnectionFactory(int qLen,
int bufSize)
Create a DefaultConnectionFactory with the given maximum operation queue length, and the given read buffer size. |
|
DefaultConnectionFactory(int qLen,
int bufSize,
HashAlgorithm hash)
Construct a DefaultConnectionFactory with the given parameters. |
|
| Method Summary | |
|---|---|
MemcachedConnection |
createConnection(java.util.List<java.net.InetSocketAddress> addrs)
Create a MemcachedConnection for the given SocketAddresses. |
NodeLocator |
createLocator(java.util.List<MemcachedNode> nodes)
Create a NodeLocator instance for the given list of nodes. |
MemcachedNode |
createMemcachedNode(java.net.SocketAddress sa,
java.nio.channels.SocketChannel c,
int bufSize)
Create a new memcached node. |
java.util.concurrent.BlockingQueue<Operation> |
createOperationQueue()
Create a BlockingQueue for operations for a connection. |
java.util.concurrent.BlockingQueue<Operation> |
createReadOperationQueue()
Create a BlockingQueue for the operations currently expecting to read responses from memcached. |
java.util.concurrent.BlockingQueue<Operation> |
createWriteOperationQueue()
Create a BlockingQueue for the operations currently expecting to write requests to memcached. |
HashAlgorithm |
getHashAlg()
Get the hash algorithm set at construct time. |
OperationFactory |
getOperationFactory()
Get the operation factory for connections built by this connection factory. |
long |
getOperationTimeout()
Get the operation timeout used by this connection. |
int |
getOpQueueLen()
Get the op queue length set at construct time. |
int |
getReadBufSize()
Get the read buffer size set at construct time. |
boolean |
isDaemon()
If true, the IO thread should be a daemon thread. |
| Methods inherited from class net.spy.SpyObject |
|---|
getLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_OP_QUEUE_LEN
public static final int DEFAULT_READ_BUFFER_SIZE
public static final long DEFAULT_OPERATION_TIMEOUT
| Constructor Detail |
|---|
public DefaultConnectionFactory(int qLen,
int bufSize,
HashAlgorithm hash)
hashAlgorithm - the algorithm to use for hashingbufSize - the buffer sizeqLen - the queue length.
public DefaultConnectionFactory(int qLen,
int bufSize)
public DefaultConnectionFactory()
| Method Detail |
|---|
public MemcachedNode createMemcachedNode(java.net.SocketAddress sa,
java.nio.channels.SocketChannel c,
int bufSize)
ConnectionFactory
createMemcachedNode in interface ConnectionFactory
public MemcachedConnection createConnection(java.util.List<java.net.InetSocketAddress> addrs)
throws java.io.IOException
ConnectionFactory
createConnection in interface ConnectionFactoryaddrs - the addresses of the memcached servers
java.io.IOException - for problems initializing the memcached connectionspublic java.util.concurrent.BlockingQueue<Operation> createOperationQueue()
ConnectionFactory
createOperationQueue in interface ConnectionFactorypublic java.util.concurrent.BlockingQueue<Operation> createReadOperationQueue()
ConnectionFactory
createReadOperationQueue in interface ConnectionFactorypublic java.util.concurrent.BlockingQueue<Operation> createWriteOperationQueue()
ConnectionFactory
createWriteOperationQueue in interface ConnectionFactorypublic NodeLocator createLocator(java.util.List<MemcachedNode> nodes)
ConnectionFactory
createLocator in interface ConnectionFactorypublic int getOpQueueLen()
public int getReadBufSize()
public HashAlgorithm getHashAlg()
public OperationFactory getOperationFactory()
ConnectionFactory
getOperationFactory in interface ConnectionFactorypublic long getOperationTimeout()
ConnectionFactory
getOperationTimeout in interface ConnectionFactorypublic boolean isDaemon()
ConnectionFactory
isDaemon in interface ConnectionFactory
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||