public class CouchbaseConnectionFactory
extends net.spy.memcached.BinaryConnectionFactory
This implementation creates connections where the operation queue is an
ArrayBlockingQueue and the read and write queues are unbounded
LinkedBlockingQueues. The Retry
FailureMode and
KetamaHash
VBucket hashing mechanism are always used. If other
configurations are needed, look at the ConnectionFactoryBuilder.
Modifier and Type | Field and Description |
---|---|
protected ConfigurationProvider |
configurationProvider |
static net.spy.memcached.FailureMode |
DEFAULT_FAILURE_MODE
Default failure mode.
|
static net.spy.memcached.HashAlgorithm |
DEFAULT_HASH
Default hash algorithm.
|
static long |
DEFAULT_MIN_RECONNECT_INTERVAL
Specify a default minimum reconnect interval of 1.1s.
|
static long |
DEFAULT_OBS_POLL_INTERVAL
Default Observe poll interval in ms.
|
static int |
DEFAULT_OBS_POLL_MAX
Default maximum amount of poll cycles before failure.
|
static int |
DEFAULT_OP_QUEUE_LEN
Maximum length of the operation queue returned by this connection factory.
|
static CouchbaseNodeOrder |
DEFAULT_STREAMING_NODE_ORDER
Default Node ordering to use for streaming connection.
|
static int |
DEFAULT_VIEW_TIMEOUT
Default View request timeout in ms.
|
Constructor and Description |
---|
CouchbaseConnectionFactory()
Create a new
CouchbaseConnectionFactory and load the required
connection information from system properties. |
CouchbaseConnectionFactory(java.util.List<java.net.URI> baseList,
java.lang.String bucketName,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
net.spy.memcached.MemcachedConnection |
createConnection(java.util.List<java.net.InetSocketAddress> addrs) |
net.spy.memcached.NodeLocator |
createLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes) |
ViewConnection |
createViewConnection(java.util.List<java.net.InetSocketAddress> addrs) |
ViewNode |
createViewNode(java.net.InetSocketAddress addr,
AsyncConnectionManager connMgr) |
net.spy.memcached.auth.AuthDescriptor |
getAuthDescriptor() |
java.lang.String |
getBucketName() |
ClusterManager |
getClusterManager()
Returns a ClusterManager and initializes one if it does not exist.
|
ConfigurationProvider |
getConfigurationProvider() |
CouchbaseNodeOrder |
getStreamingNodeOrder() |
Config |
getVBucketConfig() |
int |
getViewTimeout() |
protected boolean |
pastReconnThreshold()
Checks if there have been more requests than allowed through
maxConfigCheck in a 10 second period.
|
protected void |
requestConfigReconnect(java.lang.String bucketName,
Reconfigurable rec) |
boolean |
shouldOptimize() |
void |
updateStoredBaseList(Config config)
Updates the stored base list with a new one based on the config.
|
createMemcachedNode, getName, getOperationFactory
createOperationQueue, createReadOperationQueue, createWriteOperationQueue, enableMetrics, getDefaultTranscoder, getFailureMode, getHashAlg, getInitialObservers, getListenerExecutorService, getMaxReconnectDelay, getMetricCollector, getOperationTimeout, getOpQueueLen, getOpQueueMaxBlockTime, getReadBufSize, getTimeoutExceptionThreshold, isDaemon, isDefaultExecutorService, toString, useNagleAlgorithm
public static final net.spy.memcached.FailureMode DEFAULT_FAILURE_MODE
public static final net.spy.memcached.HashAlgorithm DEFAULT_HASH
public static final int DEFAULT_OP_QUEUE_LEN
public static final long DEFAULT_MIN_RECONNECT_INTERVAL
public static final int DEFAULT_VIEW_TIMEOUT
public static final long DEFAULT_OBS_POLL_INTERVAL
public static final int DEFAULT_OBS_POLL_MAX
public static final CouchbaseNodeOrder DEFAULT_STREAMING_NODE_ORDER
protected volatile ConfigurationProvider configurationProvider
public CouchbaseConnectionFactory()
CouchbaseConnectionFactory
and load the required
connection information from system properties.
The following properties need to be set in order to bootstrap: - cbclient.nodes: ;-separated list of URIs - cbclient.bucket: name of the bucket - cbclient.password: password of the bucket
public CouchbaseConnectionFactory(java.util.List<java.net.URI> baseList, java.lang.String bucketName, java.lang.String password) throws java.io.IOException
java.io.IOException
public ViewNode createViewNode(java.net.InetSocketAddress addr, AsyncConnectionManager connMgr)
public net.spy.memcached.MemcachedConnection createConnection(java.util.List<java.net.InetSocketAddress> addrs) throws java.io.IOException
createConnection
in interface net.spy.memcached.ConnectionFactory
createConnection
in class net.spy.memcached.DefaultConnectionFactory
java.io.IOException
public ViewConnection createViewConnection(java.util.List<java.net.InetSocketAddress> addrs) throws java.io.IOException
java.io.IOException
public net.spy.memcached.NodeLocator createLocator(java.util.List<net.spy.memcached.MemcachedNode> nodes)
createLocator
in interface net.spy.memcached.ConnectionFactory
createLocator
in class net.spy.memcached.DefaultConnectionFactory
public boolean shouldOptimize()
shouldOptimize
in interface net.spy.memcached.ConnectionFactory
shouldOptimize
in class net.spy.memcached.DefaultConnectionFactory
public net.spy.memcached.auth.AuthDescriptor getAuthDescriptor()
getAuthDescriptor
in interface net.spy.memcached.ConnectionFactory
getAuthDescriptor
in class net.spy.memcached.DefaultConnectionFactory
public java.lang.String getBucketName()
public int getViewTimeout()
public CouchbaseNodeOrder getStreamingNodeOrder()
public Config getVBucketConfig()
public ConfigurationProvider getConfigurationProvider()
protected void requestConfigReconnect(java.lang.String bucketName, Reconfigurable rec)
protected boolean pastReconnThreshold()
public ClusterManager getClusterManager()
public void updateStoredBaseList(Config config)
config
- Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.