Package net.spy.memcached.ops
Interface Operation
- All Known Subinterfaces:
CASOperation
,ConcatenationOperation
,DeleteOperation
,FlushOperation
,GetAndTouchOperation
,GetlOperation
,GetOperation
,GetsOperation
,KeyedOperation
,MutatorOperation
,NoopOperation
,ObserveOperation
,ReplicaGetOperation
,ReplicaGetsOperation
,SASLAuthOperation
,SASLMechsOperation
,SASLStepOperation
,StatsOperation
,StoreOperation
,TapOperation
,TouchOperation
,UnlockOperation
,VersionOperation
- All Known Implementing Classes:
BaseGetOpImpl
,BaseOperationImpl
,BaseStoreOperationImpl
,CASOperationImpl
,ConcatenationOperationImpl
,ConcatenationOperationImpl
,DeleteOperationImpl
,DeleteOperationImpl
,FlushOperationImpl
,FlushOperationImpl
,GetAndTouchOperationImpl
,GetAndTouchOperationImpl
,GetlOperationImpl
,GetlOperationImpl
,GetOperationImpl
,GetOperationImpl
,GetsOperationImpl
,GetsOperationImpl
,KeyStatsOperationImpl
,MultiGetOperationImpl
,MultiKeyOperationImpl
,MutatorOperationImpl
,MutatorOperationImpl
,NoopOperationImpl
,ObserveOperationImpl
,OperationImpl
,OperationImpl
,OptimizedGetImpl
,OptimizedGetImpl
,OptimizedSetImpl
,ReplicaGetOperationImpl
,ReplicaGetsOperationImpl
,SASLAuthOperationImpl
,SASLBaseOperationImpl
,SASLMechsOperationImpl
,SASLStepOperationImpl
,SingleKeyOperationImpl
,StatsOperationImpl
,StatsOperationImpl
,StoreOperationImpl
,StoreOperationImpl
,TapAckOperationImpl
,TapBackfillOperationImpl
,TapCustomOperationImpl
,TapDumpOperationImpl
,TapOperationImpl
,TouchOperationImpl
,TouchOperationImpl
,UnlockOperationImpl
,UnlockOperationImpl
,VersionOperationImpl
,VersionOperationImpl
public interface Operation
Base interface for all operations.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the clone from this operation.void
cancel()
Cancel this operation.Get the write buffer for this operation.Get the callback for this get operation.int
Returns the number of times this operation has been cloned.byte[]
Returns the raw bytes of the error message content.Get the exception that occurred (or null if no exception occurred).Get the node that should've been handling this operation.getState()
Get the current state of this operation.long
Returns the timestamp from the point where the WRITE was completed.void
handleRead
(ByteBuffer data) Handle a raw data read.boolean
True if an error occurred while processing this operation.void
Initialize this operation.boolean
Has this operation been cancelled?boolean
True if the operation has timed out.boolean
isTimedOut
(long ttlMillis) True if the operation has timed out.boolean
True if the operation has timed out and has not been sent.void
readFromBuffer
(ByteBuffer data) Read data from the given byte buffer and dispatch to the appropriate read mechanism.void
setCloneCount
(int count) Sets the clone count for this operation.void
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.void
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.
-
Method Details
-
isCancelled
boolean isCancelled()Has this operation been cancelled? -
hasErrored
boolean hasErrored()True if an error occurred while processing this operation. -
getException
OperationException getException()Get the exception that occurred (or null if no exception occurred). -
getCallback
OperationCallback getCallback()Get the callback for this get operation. -
cancel
void cancel()Cancel this operation. -
getState
OperationState getState()Get the current state of this operation. -
getBuffer
ByteBuffer getBuffer()Get the write buffer for this operation. -
writing
void writing()Invoked when we start writing all of the bytes from this operation to the sockets write buffer. -
writeComplete
void writeComplete()Invoked after having written all of the bytes from the supplied output buffer. -
initialize
void initialize()Initialize this operation. This is used to prepare output byte buffers and stuff. -
readFromBuffer
Read data from the given byte buffer and dispatch to the appropriate read mechanism.- Throws:
IOException
-
handleRead
Handle a raw data read. -
getHandlingNode
MemcachedNode getHandlingNode()Get the node that should've been handling this operation. -
setHandlingNode
Set a reference to the node that will be/is handling this operation.- Parameters:
to
- a memcached node
-
timeOut
void timeOut()Mark this operation as one which has exceeded its timeout value. -
isTimedOut
boolean isTimedOut()True if the operation has timed out.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
boolean isTimedOut(long ttlMillis) True if the operation has timed out. The ttl allows the caller to specify how long the operation should have been given since its creation, returning true if the operation has exceeded that time period.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.
- Parameters:
ttlMillis
- the max amount of time an operation may have existed since its creation in milliseconds.
-
isTimedOutUnsent
boolean isTimedOutUnsent()True if the operation has timed out and has not been sent. If the client has timed out this operation and knows it has not been written to the network, this will be true. -
getWriteCompleteTimestamp
long getWriteCompleteTimestamp()Returns the timestamp from the point where the WRITE was completed. This can be used to calculate the roundtrip time of the operation. -
getErrorMsg
byte[] getErrorMsg()Returns the raw bytes of the error message content.- Returns:
- the raw error message content.
-
addClone
Add the clone from this operation.- Parameters:
op
- the cloned operation.
-
getCloneCount
int getCloneCount()Returns the number of times this operation has been cloned.- Returns:
- the number of clones.
-
setCloneCount
void setCloneCount(int count) Sets the clone count for this operation.
-