public class MemcachedNodeROImpl extends java.lang.Object implements MemcachedNode
Constructor and Description |
---|
MemcachedNodeROImpl(MemcachedNode n) |
Modifier and Type | Method and Description |
---|---|
void |
addOp(Operation op)
Add an operation to the queue.
|
void |
authComplete()
Let the node know that auth is complete.
|
void |
completedRead()
Notify node of successful read.
|
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 optimizeGets)
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.
|
MemcachedConnection |
getConnection() |
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. |
boolean |
isAuthenticated()
True if this node is
authenticated. |
long |
lastReadDelta()
Milliseconds since last successful read.
|
void |
reconnecting()
Notify this node that it will be reconnecting.
|
void |
registerChannel(java.nio.channels.SocketChannel ch,
java.nio.channels.SelectionKey selectionKey)
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 |
setConnection(MemcachedConnection connection) |
void |
setContinuousTimeout(boolean isIncrease)
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.
|
public MemcachedNodeROImpl(MemcachedNode n)
public java.lang.String toString()
toString
in class java.lang.Object
public void addOp(Operation op)
MemcachedNode
addOp
in interface MemcachedNode
public void insertOp(Operation op)
MemcachedNode
insertOp
in interface MemcachedNode
public void connected()
MemcachedNode
connected
in interface MemcachedNode
public void copyInputQueue()
MemcachedNode
copyInputQueue
in interface MemcachedNode
public void fillWriteBuffer(boolean optimizeGets)
MemcachedNode
fillWriteBuffer
in interface MemcachedNode
optimizeGets
- if true, combine sequential gets into a single
multi-key getpublic void fixupOps()
MemcachedNode
fixupOps
in interface MemcachedNode
public int getBytesRemainingToWrite()
MemcachedNode
getBytesRemainingToWrite
in interface MemcachedNode
public java.nio.channels.SocketChannel getChannel()
MemcachedNode
getChannel
in interface MemcachedNode
public Operation getCurrentReadOp()
MemcachedNode
getCurrentReadOp
in interface MemcachedNode
public Operation getCurrentWriteOp()
MemcachedNode
getCurrentWriteOp
in interface MemcachedNode
public java.nio.ByteBuffer getRbuf()
MemcachedNode
getRbuf
in interface MemcachedNode
public int getReconnectCount()
MemcachedNode
getReconnectCount
in interface MemcachedNode
public int getSelectionOps()
MemcachedNode
getSelectionOps
in interface MemcachedNode
public java.nio.channels.SelectionKey getSk()
MemcachedNode
getSk
in interface MemcachedNode
public java.net.SocketAddress getSocketAddress()
MemcachedNode
getSocketAddress
in interface MemcachedNode
public java.nio.ByteBuffer getWbuf()
MemcachedNode
getWbuf
in interface MemcachedNode
public boolean hasReadOp()
MemcachedNode
hasReadOp
in interface MemcachedNode
public boolean hasWriteOp()
MemcachedNode
hasWriteOp
in interface MemcachedNode
public boolean isActive()
MemcachedNode
active.i.e. is is currently connected and expected to be able to process requests
isActive
in interface MemcachedNode
public void reconnecting()
MemcachedNode
reconnecting
in interface MemcachedNode
public void registerChannel(java.nio.channels.SocketChannel ch, java.nio.channels.SelectionKey selectionKey)
MemcachedNode
registerChannel
in interface MemcachedNode
public Operation removeCurrentReadOp()
MemcachedNode
removeCurrentReadOp
in interface MemcachedNode
public Operation removeCurrentWriteOp()
MemcachedNode
removeCurrentWriteOp
in interface MemcachedNode
public void setChannel(java.nio.channels.SocketChannel to)
MemcachedNode
setChannel
in interface MemcachedNode
public void setSk(java.nio.channels.SelectionKey to)
MemcachedNode
setSk
in interface MemcachedNode
public void setupResend()
MemcachedNode
setupResend
in interface MemcachedNode
public void transitionWriteItem()
MemcachedNode
transitionWriteItem
in interface MemcachedNode
public int writeSome() throws java.io.IOException
MemcachedNode
writeSome
in interface MemcachedNode
java.io.IOException
- if there's a problem writingpublic java.util.Collection<Operation> destroyInputQueue()
MemcachedNode
destroyInputQueue
in interface MemcachedNode
public void authComplete()
MemcachedNode
authComplete
in interface MemcachedNode
public void setupForAuth()
MemcachedNode
setupForAuth
in interface MemcachedNode
public int getContinuousTimeout()
getContinuousTimeout
in interface MemcachedNode
public void setContinuousTimeout(boolean isIncrease)
MemcachedNode
setContinuousTimeout
in interface MemcachedNode
public boolean isAuthenticated()
MemcachedNode
authenticated.
isAuthenticated
in interface MemcachedNode
public long lastReadDelta()
MemcachedNode
lastReadDelta
in interface MemcachedNode
public void completedRead()
MemcachedNode
completedRead
in interface MemcachedNode
public MemcachedConnection getConnection()
getConnection
in interface MemcachedNode
public void setConnection(MemcachedConnection connection)
setConnection
in interface MemcachedNode
Copyright © 2006-2009 Dustin Sallings, 2009-2013 Couchbase, Inc.