Package net.spy.memcached.protocol.ascii
Class OperationImpl
- java.lang.Object
-
- net.spy.memcached.compat.SpyObject
-
- net.spy.memcached.protocol.BaseOperationImpl
-
- net.spy.memcached.protocol.ascii.OperationImpl
-
- All Implemented Interfaces:
Operation
- Direct Known Subclasses:
BaseGetOpImpl
,BaseStoreOperationImpl
,CASOperationImpl
,DeleteOperationImpl
,FlushOperationImpl
,MutatorOperationImpl
,StatsOperationImpl
,TouchOperationImpl
,UnlockOperationImpl
,VersionOperationImpl
abstract class OperationImpl extends BaseOperationImpl implements Operation
Operations on a memcached connection.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.ByteArrayOutputStream
byteBuffer
private static java.lang.String
CHARSET
protected static byte[]
CRLF
private byte[]
errorMsg
private boolean
foundCr
private OperationReadType
readType
-
Fields inherited from class net.spy.memcached.protocol.BaseOperationImpl
callback, CANCELLED, notMyVbucketNodes, TIMED_OUT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OperationImpl()
protected
OperationImpl(OperationCallback cb)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) OperationErrorType
classifyError(java.lang.String line)
byte[]
getErrorMsg()
Returns the raw bytes of the error message content.protected OperationReadType
getReadType()
abstract void
handleLine(java.lang.String line)
protected OperationStatus
matchStatus(java.lang.String line, OperationStatus... statii)
Match the status line provided against one of the given OperationStatus objects.void
readFromBuffer(java.nio.ByteBuffer data)
Read data from the given byte buffer and dispatch to the appropriate read mechanism.protected void
setArguments(java.nio.ByteBuffer bb, java.lang.Object... args)
Set some arguments for an operation into the given byte buffer.protected void
setReadType(OperationReadType to)
Set the read type of this operation.-
Methods inherited from class net.spy.memcached.protocol.BaseOperationImpl
addClone, cancel, getBuffer, getCallback, getCloneCount, getException, getHandlingNode, getState, getWriteCompleteTimestamp, handleError, handleRead, hasErrored, initialize, isCancelled, isTimedOut, isTimedOut, isTimedOutUnsent, setBuffer, setCallback, setCloneCount, setHandlingNode, timeOut, transitionState, wasCancelled, writeComplete, writing
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.spy.memcached.ops.Operation
addClone, cancel, getBuffer, getCallback, getCloneCount, getException, getHandlingNode, getState, getWriteCompleteTimestamp, handleRead, hasErrored, initialize, isCancelled, isTimedOut, isTimedOut, isTimedOutUnsent, setCloneCount, setHandlingNode, timeOut, writeComplete, writing
-
-
-
-
Field Detail
-
CRLF
protected static final byte[] CRLF
-
CHARSET
private static final java.lang.String CHARSET
- See Also:
- Constant Field Values
-
byteBuffer
private final java.io.ByteArrayOutputStream byteBuffer
-
readType
private OperationReadType readType
-
foundCr
private boolean foundCr
-
errorMsg
private byte[] errorMsg
-
-
Constructor Detail
-
OperationImpl
protected OperationImpl()
-
OperationImpl
protected OperationImpl(OperationCallback cb)
-
-
Method Detail
-
matchStatus
protected final OperationStatus matchStatus(java.lang.String line, OperationStatus... statii)
Match the status line provided against one of the given OperationStatus objects. If none match, return a failure status with the given line.- Parameters:
line
- the current linestatii
- several status objects- Returns:
- the appropriate status object
-
getReadType
protected final OperationReadType getReadType()
-
setReadType
protected final void setReadType(OperationReadType to)
Set the read type of this operation.
-
setArguments
protected final void setArguments(java.nio.ByteBuffer bb, java.lang.Object... args)
Set some arguments for an operation into the given byte buffer.
-
classifyError
OperationErrorType classifyError(java.lang.String line)
-
readFromBuffer
public void readFromBuffer(java.nio.ByteBuffer data) throws java.io.IOException
Description copied from interface:Operation
Read data from the given byte buffer and dispatch to the appropriate read mechanism.- Specified by:
readFromBuffer
in interfaceOperation
- Specified by:
readFromBuffer
in classBaseOperationImpl
- Throws:
java.io.IOException
-
handleLine
public abstract void handleLine(java.lang.String line)
-
getErrorMsg
public byte[] getErrorMsg()
Description copied from interface:Operation
Returns the raw bytes of the error message content.- Specified by:
getErrorMsg
in interfaceOperation
- Returns:
- the raw error message content.
-
-