|
||||||||||
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.BaseOperationImpl
public abstract class BaseOperationImpl
Base class for protocol-specific operation implementations.
Field Summary | |
---|---|
protected OperationCallback |
callback
|
static OperationStatus |
CANCELLED
Status object for canceled operations. |
protected java.util.Collection<MemcachedNode> |
notMyVbucketNodes
|
static OperationStatus |
TIMED_OUT
|
Constructor Summary | |
---|---|
BaseOperationImpl()
|
Method Summary | |
---|---|
void |
cancel()
Cancel this operation. |
java.nio.ByteBuffer |
getBuffer()
Get the write buffer for this operation. |
OperationCallback |
getCallback()
Get the operation callback associated with this operation. |
OperationException |
getException()
Get the exception that occurred (or null if no exception occurred). |
MemcachedNode |
getHandlingNode()
Get the node that should've been handling this operation. |
OperationState |
getState()
Get the current state of this operation. |
protected void |
handleError(OperationErrorType eType,
java.lang.String line)
|
void |
handleRead(java.nio.ByteBuffer data)
Handle a raw data read. |
boolean |
hasErrored()
True if an error occurred while processing this operation. |
abstract void |
initialize()
Initialize this operation. |
boolean |
isCancelled()
Has this operation been cancelled? |
boolean |
isTimedOut()
True if the operation has timed out. |
boolean |
isTimedOut(long ttlMillis)
True if the operation has timed out. |
boolean |
isTimedOutUnsent()
True if the operation has timed out and has not been sent. |
abstract void |
readFromBuffer(java.nio.ByteBuffer data)
Read data from the given byte buffer and dispatch to the appropriate read mechanism. |
protected void |
setBuffer(java.nio.ByteBuffer to)
Set the write buffer for this operation. |
protected void |
setCallback(OperationCallback to)
Set the callback for this instance. |
void |
setHandlingNode(MemcachedNode to)
Set a reference to the node that will be/is handling this operation. |
void |
timeOut()
Mark this operation as one which has exceeded its timeout value. |
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()
Invoked after having written all of the bytes from the supplied output buffer. |
void |
writing()
Invoked when we start writing all of the bytes from this operation to the sockets write buffer. |
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 |
---|
public static final OperationStatus CANCELLED
public static final OperationStatus TIMED_OUT
protected OperationCallback callback
protected java.util.Collection<MemcachedNode> notMyVbucketNodes
Constructor Detail |
---|
public BaseOperationImpl()
Method Detail |
---|
public final OperationCallback getCallback()
getCallback
in interface Operation
protected void setCallback(OperationCallback to)
public final boolean isCancelled()
Operation
isCancelled
in interface Operation
public final boolean hasErrored()
Operation
hasErrored
in interface Operation
public final OperationException getException()
Operation
getException
in interface Operation
public final void cancel()
Operation
cancel
in interface Operation
protected void wasCancelled()
public final OperationState getState()
Operation
getState
in interface Operation
public final java.nio.ByteBuffer getBuffer()
Operation
getBuffer
in interface Operation
protected final void setBuffer(java.nio.ByteBuffer to)
protected final void transitionState(OperationState newState)
public final void writing()
Operation
writing
in interface Operation
public final void writeComplete()
Operation
writeComplete
in interface Operation
public abstract void initialize()
Operation
initialize
in interface Operation
public abstract void readFromBuffer(java.nio.ByteBuffer data) throws java.io.IOException
Operation
readFromBuffer
in interface Operation
java.io.IOException
protected void handleError(OperationErrorType eType, java.lang.String line) throws java.io.IOException
java.io.IOException
public void handleRead(java.nio.ByteBuffer data)
Operation
handleRead
in interface Operation
public MemcachedNode getHandlingNode()
Operation
getHandlingNode
in interface Operation
public void setHandlingNode(MemcachedNode to)
Operation
setHandlingNode
in interface Operation
to
- a memcached nodepublic void timeOut()
Operation
timeOut
in interface Operation
public boolean isTimedOut()
Operation
A timed out operation may or may not have been sent to the server already, but it exceeded either the specified or the default timeout value.
isTimedOut
in interface Operation
public boolean isTimedOut(long ttlMillis)
Operation
A timed out operation may or may not have been sent to the server already, but it exceeded either the specified or the default timeout value.
In the rare case this may be called with a longer timeout value after having been called with a shorter value that caused the operation to be timed out, an IllegalArgumentException may be thrown.
isTimedOut
in interface Operation
ttlMillis
- the max amount of time an operation may have existed since
its creation in milliseconds.public boolean isTimedOutUnsent()
Operation
isTimedOutUnsent
in interface Operation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |