net.spy.memcached
Interface ConnectionFactory

All Known Implementing Classes:
BinaryConnectionFactory, DefaultConnectionFactory, KetamaConnectionFactory

public interface ConnectionFactory

Factory for creating instances of MemcachedConnection. This is used to provide more fine-grained configuration of connections.


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.
 OperationFactory getOperationFactory()
          Get the operation factory for connections built by this connection factory.
 long getOperationTimeout()
          Get the operation timeout used by this connection.
 boolean isDaemon()
          If true, the IO thread should be a daemon thread.
 

Method Detail

createConnection

MemcachedConnection createConnection(java.util.List<java.net.InetSocketAddress> addrs)
                                     throws java.io.IOException
Create a MemcachedConnection for the given SocketAddresses.

Parameters:
addrs - the addresses of the memcached servers
Returns:
a new MemcachedConnection connected to those addresses
Throws:
java.io.IOException - for problems initializing the memcached connections

createMemcachedNode

MemcachedNode createMemcachedNode(java.net.SocketAddress sa,
                                  java.nio.channels.SocketChannel c,
                                  int bufSize)
Create a new memcached node.


createOperationQueue

java.util.concurrent.BlockingQueue<Operation> createOperationQueue()
Create a BlockingQueue for operations for a connection.


createReadOperationQueue

java.util.concurrent.BlockingQueue<Operation> createReadOperationQueue()
Create a BlockingQueue for the operations currently expecting to read responses from memcached.


createWriteOperationQueue

java.util.concurrent.BlockingQueue<Operation> createWriteOperationQueue()
Create a BlockingQueue for the operations currently expecting to write requests to memcached.


createLocator

NodeLocator createLocator(java.util.List<MemcachedNode> nodes)
Create a NodeLocator instance for the given list of nodes.


getOperationFactory

OperationFactory getOperationFactory()
Get the operation factory for connections built by this connection factory.


getOperationTimeout

long getOperationTimeout()
Get the operation timeout used by this connection.


isDaemon

boolean isDaemon()
If true, the IO thread should be a daemon thread.