public class CouchbaseConnection extends net.spy.memcached.MemcachedConnection implements Reconfigurable
Modifier and Type | Field and Description |
---|---|
protected static int |
ALLOWED_IDLE_TIME
The amount in seconds after which a op broadcast is forced to detect
dead connections.
|
protected CouchbaseConnectionFactory |
cf |
protected long |
lastWrite |
protected boolean |
reconfiguring |
Constructor and Description |
---|
CouchbaseConnection(int bufSize,
CouchbaseConnectionFactory f,
java.util.List<java.net.InetSocketAddress> a,
java.util.Collection<net.spy.memcached.ConnectionObserver> obs,
net.spy.memcached.FailureMode fm,
net.spy.memcached.OperationFactory opfactory) |
Modifier and Type | Method and Description |
---|---|
void |
addOperation(java.lang.String key,
net.spy.memcached.ops.Operation o)
Add an operation to the given connection.
|
void |
addOperations(java.util.Map<net.spy.memcached.MemcachedNode,net.spy.memcached.ops.Operation> ops) |
protected void |
handleRetryInformation(byte[] retryMessage) |
protected void |
handleWokenUpSelector()
Make sure that if the selector is woken up manually for an extended period
of time that the sockets are still alive.
|
protected void |
queueReconnect(net.spy.memcached.MemcachedNode node)
Only queue for reconnect if the given node is still part of the cluster.
|
void |
reconfigure(Bucket bucket)
Call on a configuration update.
|
java.lang.String |
replaceConfigWildcards(java.lang.String original)
Helper method to parse config wildcards into their actual representations.
|
void |
run()
Infinitely loop processing IO.
|
protected void |
updateLastWrite()
Helper method to centralize updating the last write timestamp.
|
addObserver, addOperation, broadcastOperation, broadcastOperation, checkState, connectionsStatus, createConnections, enqueueOperation, getLocator, handleIO, insertOperation, isShutDown, opSucceeded, opTimedOut, redistributeOperation, redistributeOperations, registerMetrics, removeObserver, retryOperation, shutdown, toString
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
protected static final int ALLOWED_IDLE_TIME
protected volatile boolean reconfiguring
protected final CouchbaseConnectionFactory cf
protected volatile long lastWrite
public CouchbaseConnection(int bufSize, CouchbaseConnectionFactory f, java.util.List<java.net.InetSocketAddress> a, java.util.Collection<net.spy.memcached.ConnectionObserver> obs, net.spy.memcached.FailureMode fm, net.spy.memcached.OperationFactory opfactory) throws java.io.IOException
java.io.IOException
public void reconfigure(Bucket bucket)
Reconfigurable
reconfigure
in interface Reconfigurable
bucket
- updated vbucket configurationpublic void addOperation(java.lang.String key, net.spy.memcached.ops.Operation o)
addOperation
in class net.spy.memcached.MemcachedConnection
key
- the key the operation is operating upono
- the operationpublic void addOperations(java.util.Map<net.spy.memcached.MemcachedNode,net.spy.memcached.ops.Operation> ops)
addOperations
in class net.spy.memcached.MemcachedConnection
public void run()
run
in interface java.lang.Runnable
run
in class net.spy.memcached.MemcachedConnection
protected void handleRetryInformation(byte[] retryMessage)
handleRetryInformation
in class net.spy.memcached.MemcachedConnection
protected void queueReconnect(net.spy.memcached.MemcachedNode node)
queueReconnect
in class net.spy.memcached.MemcachedConnection
node
- the node to check.public java.lang.String replaceConfigWildcards(java.lang.String original)
original
- the raw new config string.protected void updateLastWrite()
protected void handleWokenUpSelector()
This is done by broadcasting a operation so that disconnected sockets are discovered even when no load is applied.
handleWokenUpSelector
in class net.spy.memcached.MemcachedConnection
Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.