DefaultConnectionFactory Class Reference

Inherits net::spy::SpyObject, and net::spy::memcached::ConnectionFactory.

Inherited by BinaryConnectionFactory, and KetamaConnectionFactory.

Collaboration diagram for DefaultConnectionFactory:

Collaboration graph
[legend]

List of all members.

Public Member Functions

MemcachedConnection createConnection (List< InetSocketAddress > addrs) throws IOException
NodeLocator createLocator (List< MemcachedNode > nodes)
MemcachedNode createMemcachedNode (SocketAddress sa, SocketChannel c, int bufSize)
BlockingQueue< OperationcreateOperationQueue ()
BlockingQueue< OperationcreateReadOperationQueue ()
BlockingQueue< OperationcreateWriteOperationQueue ()
 DefaultConnectionFactory ()
 DefaultConnectionFactory (int qLen, int bufSize)
 DefaultConnectionFactory (int qLen, int bufSize, HashAlgorithm hash)
HashAlgorithm getHashAlg ()
OperationFactory getOperationFactory ()
long getOperationTimeout ()
int getOpQueueLen ()
int getReadBufSize ()
boolean isDaemon ()

Static Public Attributes

static final int DEFAULT_OP_QUEUE_LEN = 16384
static final long DEFAULT_OPERATION_TIMEOUT = 1000
static final int DEFAULT_READ_BUFFER_SIZE = 16384

Private Attributes

final HashAlgorithm hashAlg
final int opQueueLen
final int readBufSize


Detailed Description

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.


Constructor & Destructor Documentation

DefaultConnectionFactory ( int  qLen,
int  bufSize,
HashAlgorithm  hash 
)

Construct a DefaultConnectionFactory with the given parameters.

Parameters:
hashAlgorithm the algorithm to use for hashing
bufSize the buffer size
qLen the queue length.

DefaultConnectionFactory ( int  qLen,
int  bufSize 
)

Create a DefaultConnectionFactory with the given maximum operation queue length, and the given read buffer size.

Create a DefaultConnectionFactory with the default parameters.


Member Function Documentation

MemcachedConnection createConnection ( List< InetSocketAddress >  addrs  )  throws IOException

Create a MemcachedConnection for the given SocketAddresses.

Parameters:
addrs the addresses of the memcached servers
Returns:
a new MemcachedConnection connected to those addresses
Exceptions:
IOException for problems initializing the memcached connections

Implements ConnectionFactory.

NodeLocator createLocator ( List< MemcachedNode nodes  ) 

Create a NodeLocator instance for the given list of nodes.

Implements ConnectionFactory.

Reimplemented in KetamaConnectionFactory.

MemcachedNode createMemcachedNode ( SocketAddress  sa,
SocketChannel  c,
int  bufSize 
)

Create a new memcached node.

Implements ConnectionFactory.

Reimplemented in BinaryConnectionFactory.

BlockingQueue<Operation> createOperationQueue (  ) 

Create a BlockingQueue for operations for a connection.

Implements ConnectionFactory.

BlockingQueue<Operation> createReadOperationQueue (  ) 

Create a BlockingQueue for the operations currently expecting to read responses from memcached.

Implements ConnectionFactory.

BlockingQueue<Operation> createWriteOperationQueue (  ) 

Create a BlockingQueue for the operations currently expecting to write requests to memcached.

Implements ConnectionFactory.

HashAlgorithm getHashAlg (  ) 

Get the hash algorithm set at construct time.

OperationFactory getOperationFactory (  ) 

Get the operation factory for connections built by this connection factory.

Implements ConnectionFactory.

Reimplemented in BinaryConnectionFactory.

long getOperationTimeout (  ) 

Get the operation timeout used by this connection.

Implements ConnectionFactory.

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.

Implements ConnectionFactory.


Member Data Documentation

final int DEFAULT_OP_QUEUE_LEN = 16384 [static]

Maximum length of the operation queue returned by this connection factory.

final long DEFAULT_OPERATION_TIMEOUT = 1000 [static]

Default operation timeout in milliseconds.

final int DEFAULT_READ_BUFFER_SIZE = 16384 [static]

The read buffer size for each server connection from this factory.

final HashAlgorithm hashAlg [private]

final int opQueueLen [private]

final int readBufSize [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:37 2012 for Project Wonder by  doxygen 1.5.8