|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.spy.memcached.compat.SpyObject
net.spy.memcached.protocol.TCPMemcachedNodeImpl
public abstract class TCPMemcachedNodeImpl
Represents a node with the memcached cluster, along with buffering and operation queues.
| Field Summary | |
|---|---|
protected Operation |
optimizedOp
|
protected java.util.concurrent.BlockingQueue<Operation> |
writeQ
|
| Constructor Summary | |
|---|---|
TCPMemcachedNodeImpl(java.net.SocketAddress sa,
java.nio.channels.SocketChannel c,
int bufSize,
java.util.concurrent.BlockingQueue<Operation> rq,
java.util.concurrent.BlockingQueue<Operation> wq,
java.util.concurrent.BlockingQueue<Operation> iq,
long opQueueMaxBlockTime,
boolean waitForAuth,
long dt)
|
|
| Method Summary | |
|---|---|
void |
addOp(Operation op)
Add an operation to the queue. |
void |
authComplete()
Let the node know that auth is complete. |
void |
connected()
Notify this node that it has reconnected. |
void |
copyInputQueue()
Move all of the operations delivered via addOperation into the internal write queue. |
java.util.Collection<Operation> |
destroyInputQueue()
Extract all queued items for this node destructively. |
void |
fillWriteBuffer(boolean shouldOptimize)
Fill the write buffer with data from the next operations in the queue. |
void |
fixupOps()
Fix up the selection ops on the selection key. |
int |
getBytesRemainingToWrite()
Get the number of bytes remaining to write. |
java.nio.channels.SocketChannel |
getChannel()
Get the SocketChannel for this connection. |
int |
getContinuousTimeout()
|
Operation |
getCurrentReadOp()
Get the operation at the top of the queue that is requiring input. |
Operation |
getCurrentWriteOp()
Get the operation at the top of the queue that has information available to write. |
java.nio.ByteBuffer |
getRbuf()
Get the buffer used for reading data from this node. |
int |
getReconnectCount()
Get the current reconnect count. |
int |
getSelectionOps()
Compute the appropriate selection operations for the channel this MemcachedNode holds to the server. |
java.nio.channels.SelectionKey |
getSk()
Get the selection key from this node. |
java.net.SocketAddress |
getSocketAddress()
Get the SocketAddress of the server to which this node is connected. |
java.nio.ByteBuffer |
getWbuf()
Get the buffer used for writing data to this node. |
boolean |
hasReadOp()
True if an operation is available to read. |
boolean |
hasWriteOp()
True if an operation is available to write. |
void |
insertOp(Operation op)
Insert an operation to the beginning of the queue. |
boolean |
isActive()
True if this node is active.i.e. |
protected abstract void |
optimize()
|
void |
reconnecting()
Notify this node that it will be reconnecting. |
void |
registerChannel(java.nio.channels.SocketChannel ch,
java.nio.channels.SelectionKey skey)
Register a channel with this node. |
Operation |
removeCurrentReadOp()
Remove the operation at the top of the queue that is requiring input. |
Operation |
removeCurrentWriteOp()
Remove the operation at the top of the queue that has information available to write. |
void |
setChannel(java.nio.channels.SocketChannel to)
Set the SocketChannel this node uses. |
void |
setContinuousTimeout(boolean timedOut)
Count 'time out' exceptions to drop connections that fail perpetually. |
void |
setSk(java.nio.channels.SelectionKey to)
Set the selection key for this node. |
void |
setupForAuth()
Tell a node to set up for authentication. |
void |
setupResend()
Clear the queue of currently processing operations by either cancelling them or setting them up to be reapplied after a reconnect. |
java.lang.String |
toString()
|
void |
transitionWriteItem()
Transition the current write item into a read state. |
int |
writeSome()
Write some bytes and return the number of bytes written. |
| Methods inherited from class net.spy.memcached.compat.SpyObject |
|---|
getLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.concurrent.BlockingQueue<Operation> writeQ
protected Operation optimizedOp
| Constructor Detail |
|---|
public TCPMemcachedNodeImpl(java.net.SocketAddress sa,
java.nio.channels.SocketChannel c,
int bufSize,
java.util.concurrent.BlockingQueue<Operation> rq,
java.util.concurrent.BlockingQueue<Operation> wq,
java.util.concurrent.BlockingQueue<Operation> iq,
long opQueueMaxBlockTime,
boolean waitForAuth,
long dt)
| Method Detail |
|---|
public final void copyInputQueue()
MemcachedNode
copyInputQueue in interface MemcachedNodepublic java.util.Collection<Operation> destroyInputQueue()
MemcachedNode
destroyInputQueue in interface MemcachedNodepublic final void setupResend()
MemcachedNode
setupResend in interface MemcachedNodepublic final void fillWriteBuffer(boolean shouldOptimize)
MemcachedNode
fillWriteBuffer in interface MemcachedNodeshouldOptimize - if true, combine sequential gets into a single
multi-key getpublic final void transitionWriteItem()
MemcachedNode
transitionWriteItem in interface MemcachedNodeprotected abstract void optimize()
public final Operation getCurrentReadOp()
MemcachedNode
getCurrentReadOp in interface MemcachedNodepublic final Operation removeCurrentReadOp()
MemcachedNode
removeCurrentReadOp in interface MemcachedNodepublic final Operation getCurrentWriteOp()
MemcachedNode
getCurrentWriteOp in interface MemcachedNodepublic final Operation removeCurrentWriteOp()
MemcachedNode
removeCurrentWriteOp in interface MemcachedNodepublic final boolean hasReadOp()
MemcachedNode
hasReadOp in interface MemcachedNodepublic final boolean hasWriteOp()
MemcachedNode
hasWriteOp in interface MemcachedNodepublic final void addOp(Operation op)
MemcachedNode
addOp in interface MemcachedNodepublic final void insertOp(Operation op)
MemcachedNode
insertOp in interface MemcachedNodepublic final int getSelectionOps()
MemcachedNode
getSelectionOps in interface MemcachedNodepublic final java.nio.ByteBuffer getRbuf()
MemcachedNode
getRbuf in interface MemcachedNodepublic final java.nio.ByteBuffer getWbuf()
MemcachedNode
getWbuf in interface MemcachedNodepublic final java.net.SocketAddress getSocketAddress()
MemcachedNode
getSocketAddress in interface MemcachedNodepublic final boolean isActive()
MemcachedNodeactive.i.e. is is currently connected and expected to be able to process requests
isActive in interface MemcachedNodepublic final void reconnecting()
MemcachedNode
reconnecting in interface MemcachedNodepublic final void connected()
MemcachedNode
connected in interface MemcachedNodepublic final int getReconnectCount()
MemcachedNode
getReconnectCount in interface MemcachedNodepublic final java.lang.String toString()
toString in class java.lang.Object
public final void registerChannel(java.nio.channels.SocketChannel ch,
java.nio.channels.SelectionKey skey)
MemcachedNode
registerChannel in interface MemcachedNodepublic final void setChannel(java.nio.channels.SocketChannel to)
MemcachedNode
setChannel in interface MemcachedNodepublic final java.nio.channels.SocketChannel getChannel()
MemcachedNode
getChannel in interface MemcachedNodepublic final void setSk(java.nio.channels.SelectionKey to)
MemcachedNode
setSk in interface MemcachedNodepublic final java.nio.channels.SelectionKey getSk()
MemcachedNode
getSk in interface MemcachedNodepublic final int getBytesRemainingToWrite()
MemcachedNode
getBytesRemainingToWrite in interface MemcachedNode
public final int writeSome()
throws java.io.IOException
MemcachedNode
writeSome in interface MemcachedNodejava.io.IOException - if there's a problem writingpublic void setContinuousTimeout(boolean timedOut)
MemcachedNode
setContinuousTimeout in interface MemcachedNodepublic int getContinuousTimeout()
getContinuousTimeout in interface MemcachedNodepublic final void fixupOps()
MemcachedNode
fixupOps in interface MemcachedNodepublic final void authComplete()
MemcachedNode
authComplete in interface MemcachedNodepublic final void setupForAuth()
MemcachedNode
setupForAuth in interface MemcachedNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||