TCPMemcachedNodeImpl Class Reference

Inherits net::spy::SpyObject, and net::spy::memcached::MemcachedNode.

Inherited by AsciiMemcachedNodeImpl, and BinaryMemcachedNodeImpl.

Collaboration diagram for TCPMemcachedNodeImpl:

Collaboration graph
[legend]

List of all members.

Public Member Functions

final void addOp (Operation op)
final void connected ()
final void copyInputQueue ()
final void fillWriteBuffer (boolean optimizeGets)
final void fixupOps ()
final int getBytesRemainingToWrite ()
final SocketChannel getChannel ()
final Operation getCurrentReadOp ()
final Operation getCurrentWriteOp ()
final ByteBuffer getRbuf ()
final int getReconnectCount ()
final int getSelectionOps ()
final SelectionKey getSk ()
final SocketAddress getSocketAddress ()
final ByteBuffer getWbuf ()
final boolean hasReadOp ()
final boolean hasWriteOp ()
final boolean isActive ()
final void reconnecting ()
final void registerChannel (SocketChannel ch, SelectionKey skey)
final Operation removeCurrentReadOp ()
final Operation removeCurrentWriteOp ()
final void setChannel (SocketChannel to)
final void setSk (SelectionKey to)
final void setupResend ()
 TCPMemcachedNodeImpl (SocketAddress sa, SocketChannel c, int bufSize, BlockingQueue< Operation > rq, BlockingQueue< Operation > wq, BlockingQueue< Operation > iq)
final String toString ()
final void transitionWriteItem ()
final int writeSome () throws IOException

Protected Member Functions

abstract void optimize ()

Protected Attributes

GetOperation getOp = null
final BlockingQueue< OperationwriteQ

Private Member Functions

boolean preparePending ()

Private Attributes

SocketChannel channel
final BlockingQueue< OperationinputQueue
final ByteBuffer rbuf
final BlockingQueue< OperationreadQ
volatile int reconnectAttempt = 1
SelectionKey sk = null
final SocketAddress socketAddress
int toWrite = 0
final ByteBuffer wbuf


Detailed Description

Represents a node with the memcached cluster, along with buffering and operation queues.

Constructor & Destructor Documentation

TCPMemcachedNodeImpl ( SocketAddress  sa,
SocketChannel  c,
int  bufSize,
BlockingQueue< Operation rq,
BlockingQueue< Operation wq,
BlockingQueue< Operation iq 
)


Member Function Documentation

final void addOp ( Operation  op  ) 

Add an operation to the queue.

Implements MemcachedNode.

final void connected (  ) 

Notify this node that it has reconnected.

Implements MemcachedNode.

final void copyInputQueue (  ) 

Move all of the operations delivered via addOperation into the internal write queue.

Implements MemcachedNode.

final void fillWriteBuffer ( boolean  optimizeGets  ) 

Fill the write buffer with data from the next operations in the queue.

Parameters:
optimizeGets if true, combine sequential gets into a single multi-key get

Implements MemcachedNode.

final void fixupOps (  ) 

Fix up the selection ops on the selection key.

Implements MemcachedNode.

final int getBytesRemainingToWrite (  ) 

Get the number of bytes remaining to write.

Implements MemcachedNode.

final SocketChannel getChannel (  ) 

Get the SocketChannel for this connection.

Implements MemcachedNode.

final Operation getCurrentReadOp (  ) 

Get the operation at the top of the queue that is requiring input.

Implements MemcachedNode.

final Operation getCurrentWriteOp (  ) 

Get the operation at the top of the queue that has information available to write.

Implements MemcachedNode.

final ByteBuffer getRbuf (  ) 

Get the buffer used for reading data from this node.

Implements MemcachedNode.

final int getReconnectCount (  ) 

Get the current reconnect count.

Implements MemcachedNode.

final int getSelectionOps (  ) 

Compute the appropriate selection operations for the channel this MemcachedNode holds to the server.

Implements MemcachedNode.

final SelectionKey getSk (  ) 

Get the selection key from this node.

Implements MemcachedNode.

final SocketAddress getSocketAddress (  ) 

Get the SocketAddress of the server to which this node is connected.

Implements MemcachedNode.

final ByteBuffer getWbuf (  ) 

Get the buffer used for writing data to this node.

Implements MemcachedNode.

final boolean hasReadOp (  ) 

True if an operation is available to read.

Implements MemcachedNode.

final boolean hasWriteOp (  ) 

True if an operation is available to write.

Implements MemcachedNode.

final boolean isActive (  ) 

True if this node is <q>active.</q> i.e. is is currently connected and expected to be able to process requests

Implements MemcachedNode.

abstract void optimize (  )  [protected, pure virtual]

boolean preparePending (  )  [private]

final void reconnecting (  ) 

Notify this node that it will be reconnecting.

Implements MemcachedNode.

final void registerChannel ( SocketChannel  ch,
SelectionKey  selectionKey 
)

Register a channel with this node.

Implements MemcachedNode.

final Operation removeCurrentReadOp (  ) 

Remove the operation at the top of the queue that is requiring input.

Implements MemcachedNode.

final Operation removeCurrentWriteOp (  ) 

Remove the operation at the top of the queue that has information available to write.

Implements MemcachedNode.

final void setChannel ( SocketChannel  to  ) 

Set the SocketChannel this node uses.

Implements MemcachedNode.

final void setSk ( SelectionKey  to  ) 

Set the selection key for this node.

Implements MemcachedNode.

final void setupResend (  ) 

Clear the queue of currently processing operations by either cancelling them or setting them up to be reapplied after a reconnect.

Implements MemcachedNode.

final String toString (  ) 

final void transitionWriteItem (  ) 

Transition the current write item into a read state.

Implements MemcachedNode.

final int writeSome (  )  throws IOException

Write some bytes and return the number of bytes written.

Returns:
the number of bytes written
Exceptions:
IOException if there's a problem writing

Implements MemcachedNode.


Member Data Documentation

SocketChannel channel [private]

GetOperation getOp = null [protected]

final BlockingQueue<Operation> inputQueue [private]

final ByteBuffer rbuf [private]

final BlockingQueue<Operation> readQ [private]

volatile int reconnectAttempt = 1 [private]

SelectionKey sk = null [private]

final SocketAddress socketAddress [private]

int toWrite = 0 [private]

final ByteBuffer wbuf [private]

final BlockingQueue<Operation> writeQ [protected]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:37 2012 for Project Wonder by  doxygen 1.5.8