Package net.rubyeye.xmemcached.command
Class Command
- java.lang.Object
-
- net.rubyeye.xmemcached.command.Command
-
- All Implemented Interfaces:
WriteMessage
- Direct Known Subclasses:
BaseBinaryCommand,TextAWSElasticCacheConfigCommand,TextCacheDumpCommand,TextDeleteCommand,TextFlushAllCommand,TextGetCommand,TextIncrDecrCommand,TextQuitCommand,TextStatsCommand,TextStoreCommand,TextTouchCommand,TextVersionCommand,VerbosityCommand
public abstract class Command extends java.lang.Object implements WriteMessage
Abstract Memcached Command
-
-
Field Summary
Fields Modifier and Type Field Description private booleanaddedprotected booleancancelprotected CommandTypecommandTypeprivate intcopiedMergeCountprotected java.lang.Exceptionexceptionprotected IoBufferioBufferprotected java.lang.Stringkeyprotected byte[]keyBytesprotected java.util.concurrent.CountDownLatchlatchprotected intmergeCountprotected booleannoreplystatic byteREQUEST_MAGIC_NUMBERstatic byteRESPONSE_MAGIC_NUMBERprotected java.lang.Objectresultprotected OperationStatusstatusprotected Transcodertranscoderprotected FutureImpl<java.lang.Boolean>writeFuture
-
Constructor Summary
Constructors Constructor Description Command()Command(java.lang.String key, byte[] keyBytes, java.util.concurrent.CountDownLatch latch)Command(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch)Command(java.lang.String key, CommandType commandType, java.util.concurrent.CountDownLatch latch)Command(CommandType cmdType)Command(CommandType cmdType, java.util.concurrent.CountDownLatch latch)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancel()voidcountDownLatch()abstract booleandecode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)protected voiddecodeError()protected booleandecodeError(Session session, java.nio.ByteBuffer buffer)protected booleandecodeError(java.lang.String line)protected voiddecodeError(java.lang.String msg, java.lang.Throwable e)abstract voidencode()CommandTypegetCommandType()intgetCopiedMergeCount()private java.lang.StringgetErrorMsg(java.lang.String line, java.lang.String defaultMsg)java.lang.ExceptiongetException()IoBuffergetIoBuffer()java.lang.StringgetKey()byte[]getKeyBytes()java.util.concurrent.CountDownLatchgetLatch()intgetMergeCount()java.lang.ObjectgetMessage()java.lang.ObjectgetResult()OperationStatusgetStatus()TranscodergetTranscoder()IoBuffergetWriteBuffer()FutureImpl<java.lang.Boolean>getWriteFuture()booleanisAdded()booleanisCancel()booleanisNoreply()booleanisWriting()voidsetAdded(boolean added)voidsetCommandType(CommandType commandType)voidsetException(java.lang.Exception throwable)voidsetIoBuffer(IoBuffer ioBuffer)voidsetKey(java.lang.String key)voidsetKeyBytes(byte[] keyBytes)voidsetLatch(java.util.concurrent.CountDownLatch latch)voidsetMergeCount(int mergetCount)voidsetNoreply(boolean noreply)voidsetResult(java.lang.Object result)voidsetStatus(OperationStatus status)voidsetTranscoder(Transcoder transcoder)voidsetWriteBuffer(IoBuffer buffers)voidsetWriteFuture(FutureImpl<java.lang.Boolean> writeFuture)java.lang.StringtoString()voidwriting()
-
-
-
Field Detail
-
REQUEST_MAGIC_NUMBER
public static final byte REQUEST_MAGIC_NUMBER
- See Also:
- Constant Field Values
-
RESPONSE_MAGIC_NUMBER
public static final byte RESPONSE_MAGIC_NUMBER
- See Also:
- Constant Field Values
-
added
private boolean added
-
key
protected java.lang.String key
-
keyBytes
protected byte[] keyBytes
-
result
protected java.lang.Object result
-
latch
protected java.util.concurrent.CountDownLatch latch
-
commandType
protected CommandType commandType
-
exception
protected java.lang.Exception exception
-
ioBuffer
protected IoBuffer ioBuffer
-
cancel
protected volatile boolean cancel
-
status
protected OperationStatus status
-
mergeCount
protected int mergeCount
-
copiedMergeCount
private int copiedMergeCount
-
transcoder
protected Transcoder transcoder
-
noreply
protected boolean noreply
-
writeFuture
protected FutureImpl<java.lang.Boolean> writeFuture
-
-
Constructor Detail
-
Command
public Command()
-
Command
public Command(java.lang.String key, byte[] keyBytes, java.util.concurrent.CountDownLatch latch)
-
Command
public Command(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch)
-
Command
public Command(CommandType cmdType)
-
Command
public Command(CommandType cmdType, java.util.concurrent.CountDownLatch latch)
-
Command
public Command(java.lang.String key, CommandType commandType, java.util.concurrent.CountDownLatch latch)
-
-
Method Detail
-
isAdded
public boolean isAdded()
-
setAdded
public void setAdded(boolean added)
-
getMessage
public final java.lang.Object getMessage()
- Specified by:
getMessagein interfaceWriteMessage
-
getWriteBuffer
public final IoBuffer getWriteBuffer()
- Specified by:
getWriteBufferin interfaceWriteMessage
-
setWriteBuffer
public void setWriteBuffer(IoBuffer buffers)
- Specified by:
setWriteBufferin interfaceWriteMessage
-
getKeyBytes
public final byte[] getKeyBytes()
-
setKeyBytes
public final void setKeyBytes(byte[] keyBytes)
-
setCommandType
public void setCommandType(CommandType commandType)
-
getMergeCount
public int getMergeCount()
-
getTranscoder
public Transcoder getTranscoder()
-
setTranscoder
public void setTranscoder(Transcoder transcoder)
-
setMergeCount
public void setMergeCount(int mergetCount)
-
getCopiedMergeCount
public int getCopiedMergeCount()
-
getStatus
public OperationStatus getStatus()
-
setStatus
public final void setStatus(OperationStatus status)
-
setIoBuffer
public final void setIoBuffer(IoBuffer ioBuffer)
-
getException
public java.lang.Exception getException()
-
setException
public void setException(java.lang.Exception throwable)
-
getKey
public final java.lang.String getKey()
-
setKey
public final void setKey(java.lang.String key)
-
getResult
public final java.lang.Object getResult()
-
setResult
public final void setResult(java.lang.Object result)
-
getIoBuffer
public final IoBuffer getIoBuffer()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isCancel
public boolean isCancel()
-
cancel
public final void cancel()
-
getLatch
public final java.util.concurrent.CountDownLatch getLatch()
-
countDownLatch
public final void countDownLatch()
-
getCommandType
public final CommandType getCommandType()
-
setLatch
public final void setLatch(java.util.concurrent.CountDownLatch latch)
-
encode
public abstract void encode()
-
decode
public abstract boolean decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
-
decodeError
protected final void decodeError(java.lang.String msg, java.lang.Throwable e)
-
decodeError
protected final void decodeError()
-
decodeError
protected final boolean decodeError(java.lang.String line)
-
decodeError
protected final boolean decodeError(Session session, java.nio.ByteBuffer buffer)
-
getErrorMsg
private java.lang.String getErrorMsg(java.lang.String line, java.lang.String defaultMsg)
-
isNoreply
public final boolean isNoreply()
-
setNoreply
public final void setNoreply(boolean noreply)
-
getWriteFuture
public FutureImpl<java.lang.Boolean> getWriteFuture()
- Specified by:
getWriteFuturein interfaceWriteMessage
-
setWriteFuture
public final void setWriteFuture(FutureImpl<java.lang.Boolean> writeFuture)
-
isWriting
public final boolean isWriting()
- Specified by:
isWritingin interfaceWriteMessage
-
writing
public final void writing()
- Specified by:
writingin interfaceWriteMessage
-
-