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.ByteArrayOutputStreambyteBufferprivate static java.lang.StringCHARSETprotected static byte[]CRLFprivate byte[]errorMsgprivate booleanfoundCrprivate OperationReadTypereadType-
Fields inherited from class net.spy.memcached.protocol.BaseOperationImpl
callback, CANCELLED, notMyVbucketNodes, TIMED_OUT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOperationImpl()protectedOperationImpl(OperationCallback cb)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) OperationErrorTypeclassifyError(java.lang.String line)byte[]getErrorMsg()Returns the raw bytes of the error message content.protected OperationReadTypegetReadType()abstract voidhandleLine(java.lang.String line)protected OperationStatusmatchStatus(java.lang.String line, OperationStatus... statii)Match the status line provided against one of the given OperationStatus objects.voidreadFromBuffer(java.nio.ByteBuffer data)Read data from the given byte buffer and dispatch to the appropriate read mechanism.protected voidsetArguments(java.nio.ByteBuffer bb, java.lang.Object... args)Set some arguments for an operation into the given byte buffer.protected voidsetReadType(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.IOExceptionDescription copied from interface:OperationRead data from the given byte buffer and dispatch to the appropriate read mechanism.- Specified by:
readFromBufferin interfaceOperation- Specified by:
readFromBufferin classBaseOperationImpl- Throws:
java.io.IOException
-
handleLine
public abstract void handleLine(java.lang.String line)
-
getErrorMsg
public byte[] getErrorMsg()
Description copied from interface:OperationReturns the raw bytes of the error message content.- Specified by:
getErrorMsgin interfaceOperation- Returns:
- the raw error message content.
-
-