net.spy.memcached.protocol
Class BaseOperationImpl

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by net.spy.memcached.protocol.BaseOperationImpl
Direct Known Subclasses:
ConcatenationOperationImpl, OptimizedSetImpl, StatsOperationImpl

public abstract class BaseOperationImpl
extends SpyObject

Base class for protocol-specific operation implementations.


Field Summary
protected  OperationCallback callback
           
static OperationStatus CANCELLED
          Status object for cancelled operations.
 
Constructor Summary
BaseOperationImpl()
           
 
Method Summary
 void cancel()
           
 ByteBuffer getBuffer()
           
 OperationCallback getCallback()
          Get the operation callback associated with this operation.
 OperationException getException()
           
 MemcachedNode getHandlingNode()
           
 OperationState getState()
           
protected  void handleError(OperationErrorType eType, String line)
           
 void handleRead(ByteBuffer data)
           
 boolean hasErrored()
           
abstract  void initialize()
           
 boolean isCancelled()
           
abstract  void readFromBuffer(ByteBuffer data)
           
protected  void setBuffer(ByteBuffer to)
          Set the write buffer for this operation.
protected  void setCallback(OperationCallback to)
          Set the callback for this instance.
 void setHandlingNode(MemcachedNode to)
           
protected  void transitionState(OperationState newState)
          Transition the state of this operation to the given state.
protected  void wasCancelled()
          This is called on each subclass whenever an operation was cancelled.
 void writeComplete()
           
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCELLED

public static final OperationStatus CANCELLED
Status object for cancelled operations.


callback

protected OperationCallback callback
Constructor Detail

BaseOperationImpl

public BaseOperationImpl()
Method Detail

getCallback

public final OperationCallback getCallback()
Get the operation callback associated with this operation.


setCallback

protected void setCallback(OperationCallback to)
Set the callback for this instance.


isCancelled

public final boolean isCancelled()

hasErrored

public final boolean hasErrored()

getException

public final OperationException getException()

cancel

public final void cancel()

wasCancelled

protected void wasCancelled()
This is called on each subclass whenever an operation was cancelled.


getState

public final OperationState getState()

getBuffer

public final ByteBuffer getBuffer()

setBuffer

protected final void setBuffer(ByteBuffer to)
Set the write buffer for this operation.


transitionState

protected final void transitionState(OperationState newState)
Transition the state of this operation to the given state.


writeComplete

public final void writeComplete()

initialize

public abstract void initialize()

readFromBuffer

public abstract void readFromBuffer(ByteBuffer data)
                             throws IOException
Throws:
IOException

handleError

protected void handleError(OperationErrorType eType,
                           String line)
                    throws IOException
Throws:
IOException

handleRead

public void handleRead(ByteBuffer data)

getHandlingNode

public MemcachedNode getHandlingNode()

setHandlingNode

public void setHandlingNode(MemcachedNode to)