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 boolean
added
protected boolean
cancel
protected CommandType
commandType
private int
copiedMergeCount
protected java.lang.Exception
exception
protected IoBuffer
ioBuffer
protected java.lang.String
key
protected byte[]
keyBytes
protected java.util.concurrent.CountDownLatch
latch
protected int
mergeCount
protected boolean
noreply
static byte
REQUEST_MAGIC_NUMBER
static byte
RESPONSE_MAGIC_NUMBER
protected java.lang.Object
result
protected OperationStatus
status
protected Transcoder
transcoder
protected 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 void
cancel()
void
countDownLatch()
abstract boolean
decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
protected void
decodeError()
protected boolean
decodeError(Session session, java.nio.ByteBuffer buffer)
protected boolean
decodeError(java.lang.String line)
protected void
decodeError(java.lang.String msg, java.lang.Throwable e)
abstract void
encode()
CommandType
getCommandType()
int
getCopiedMergeCount()
private java.lang.String
getErrorMsg(java.lang.String line, java.lang.String defaultMsg)
java.lang.Exception
getException()
IoBuffer
getIoBuffer()
java.lang.String
getKey()
byte[]
getKeyBytes()
java.util.concurrent.CountDownLatch
getLatch()
int
getMergeCount()
java.lang.Object
getMessage()
java.lang.Object
getResult()
OperationStatus
getStatus()
Transcoder
getTranscoder()
IoBuffer
getWriteBuffer()
FutureImpl<java.lang.Boolean>
getWriteFuture()
boolean
isAdded()
boolean
isCancel()
boolean
isNoreply()
boolean
isWriting()
void
setAdded(boolean added)
void
setCommandType(CommandType commandType)
void
setException(java.lang.Exception throwable)
void
setIoBuffer(IoBuffer ioBuffer)
void
setKey(java.lang.String key)
void
setKeyBytes(byte[] keyBytes)
void
setLatch(java.util.concurrent.CountDownLatch latch)
void
setMergeCount(int mergetCount)
void
setNoreply(boolean noreply)
void
setResult(java.lang.Object result)
void
setStatus(OperationStatus status)
void
setTranscoder(Transcoder transcoder)
void
setWriteBuffer(IoBuffer buffers)
void
setWriteFuture(FutureImpl<java.lang.Boolean> writeFuture)
java.lang.String
toString()
void
writing()
-
-
-
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:
getMessage
in interfaceWriteMessage
-
getWriteBuffer
public final IoBuffer getWriteBuffer()
- Specified by:
getWriteBuffer
in interfaceWriteMessage
-
setWriteBuffer
public void setWriteBuffer(IoBuffer buffers)
- Specified by:
setWriteBuffer
in 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:
toString
in 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:
getWriteFuture
in interfaceWriteMessage
-
setWriteFuture
public final void setWriteFuture(FutureImpl<java.lang.Boolean> writeFuture)
-
isWriting
public final boolean isWriting()
- Specified by:
isWriting
in interfaceWriteMessage
-
writing
public final void writing()
- Specified by:
writing
in interfaceWriteMessage
-
-