|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
net.spy.memcached.compat.SpyThread
net.spy.memcached.MemcachedConnection
public final class MemcachedConnection
Connection to a cluster of memcached servers.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected boolean |
reconfiguring
|
protected boolean |
running
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
MemcachedConnection(int bufSize,
ConnectionFactory f,
List<InetSocketAddress> a,
Collection<ConnectionObserver> obs,
FailureMode fm,
OperationFactory opfactory)
Construct a memcached connection. |
|
| Method Summary | |
|---|---|
boolean |
addObserver(ConnectionObserver obs)
Add a connection observer. |
void |
addOperation(String key,
Operation o)
Add an operation to the given connection. |
void |
addOperations(Map<MemcachedNode,Operation> ops)
|
CountDownLatch |
broadcastOperation(BroadcastOpFactory of)
Broadcast an operation to all nodes. |
CountDownLatch |
broadcastOperation(BroadcastOpFactory of,
Collection<MemcachedNode> nodes)
Broadcast an operation to a specific collection of nodes. |
protected void |
checkState()
|
void |
handleIO()
MemcachedClient calls this method to handle IO over the connections. |
void |
insertOperation(MemcachedNode node,
Operation o)
|
static void |
opSucceeded(Operation op)
helper method: reset timeout counter |
static void |
opTimedOut(Operation op)
helper method: increase timeout count on node attached to this op |
void |
reconfigure(Bucket bucket)
Call on a configuration update |
boolean |
removeObserver(ConnectionObserver obs)
Remove a connection observer. |
void |
run()
Infinitely loop processing IO. |
void |
shutdown()
Shut down all of the connections. |
String |
toString()
|
| Methods inherited from class net.spy.memcached.compat.SpyThread |
|---|
getLogger |
| Methods inherited from class java.lang.Thread |
|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected volatile boolean reconfiguring
protected volatile boolean running
| Constructor Detail |
|---|
public MemcachedConnection(int bufSize,
ConnectionFactory f,
List<InetSocketAddress> a,
Collection<ConnectionObserver> obs,
FailureMode fm,
OperationFactory opfactory)
throws IOException
bufSize - the size of the buffer used for reading from the serverf - the factory that will provide an operation queuea - the addresses of the servers to connect to
IOException - if a connection attempt fails early| Method Detail |
|---|
public void reconfigure(Bucket bucket)
Reconfigurable
reconfigure in interface Reconfigurablebucket - updated vbucket configuration
public void handleIO()
throws IOException
IOExceptionpublic boolean addObserver(ConnectionObserver obs)
public boolean removeObserver(ConnectionObserver obs)
public void addOperation(String key,
Operation o)
key - the key the operation is operating upono - the operation
public void insertOperation(MemcachedNode node,
Operation o)
public void addOperations(Map<MemcachedNode,Operation> ops)
public CountDownLatch broadcastOperation(BroadcastOpFactory of)
public CountDownLatch broadcastOperation(BroadcastOpFactory of,
Collection<MemcachedNode> nodes)
public void shutdown()
throws IOException
IOExceptionpublic String toString()
toString in class Threadpublic static void opTimedOut(Operation op)
op - public static void opSucceeded(Operation op)
op - protected void checkState()
public void run()
run in interface Runnablerun in class Thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||