Class TextGetCommand
- java.lang.Object
-
- net.rubyeye.xmemcached.command.Command
-
- net.rubyeye.xmemcached.command.text.TextGetCommand
-
- All Implemented Interfaces:
WriteMessage
,AssocCommandAware
,MapReturnValueAware
,MergeCommandsAware
- Direct Known Subclasses:
KestrelGetCommand
,TextGetMultiCommand
,TextGetOneCommand
public abstract class TextGetCommand extends Command implements MergeCommandsAware, AssocCommandAware, MapReturnValueAware
Abstract get command for text protocol
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TextGetCommand.ParseStatus
-
Field Summary
Fields Modifier and Type Field Description private static char[]
A_SPACE
protected java.util.List<Command>
assocCommands
When MemcachedClient merge get commands,those commans which have the same key will be merged into one get command.The result command's assocCommands contains all these commands with the same key.private java.lang.String
currentReturnKey
private static char[]
EMPTY_CHARS
protected java.util.Map<java.lang.Object,Command>
mergeCommands
private int
offset
private TextGetCommand.ParseStatus
parseStatus
protected java.util.Map<java.lang.String,CachedData>
returnValues
protected boolean
wasFirst
-
Fields inherited from class net.rubyeye.xmemcached.command.Command
cancel, commandType, exception, ioBuffer, key, keyBytes, latch, mergeCount, noreply, REQUEST_MAGIC_NUMBER, RESPONSE_MAGIC_NUMBER, result, status, transcoder, writeFuture
-
-
Constructor Summary
Constructors Constructor Description TextGetCommand(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
abstract void
dispatch()
void
encode()
java.util.List<Command>
getAssocCommands()
private java.lang.String
getItem(java.nio.ByteBuffer buffer, char token, char[] others)
java.util.Map<java.lang.Object,Command>
getMergeCommands()
TextGetCommand.ParseStatus
getParseStatus()
java.util.Map<java.lang.String,CachedData>
getReturnValues()
private java.lang.String
getString(byte[] keyBytes)
private boolean
isIn(byte b, char[] others)
void
setAssocCommands(java.util.List<Command> assocCommands)
void
setMergeCommands(java.util.Map<java.lang.Object,Command> mergeCommands)
void
setParseStatus(TextGetCommand.ParseStatus parseStatus)
void
setReturnValues(java.util.Map<java.lang.String,CachedData> returnValues)
-
Methods inherited from class net.rubyeye.xmemcached.command.Command
cancel, countDownLatch, decodeError, decodeError, decodeError, decodeError, getCommandType, getCopiedMergeCount, getException, getIoBuffer, getKey, getKeyBytes, getLatch, getMergeCount, getMessage, getResult, getStatus, getTranscoder, getWriteBuffer, getWriteFuture, isAdded, isCancel, isNoreply, isWriting, setAdded, setCommandType, setException, setIoBuffer, setKey, setKeyBytes, setLatch, setMergeCount, setNoreply, setResult, setStatus, setTranscoder, setWriteBuffer, setWriteFuture, toString, writing
-
-
-
-
Field Detail
-
A_SPACE
private static final char[] A_SPACE
-
EMPTY_CHARS
private static final char[] EMPTY_CHARS
-
returnValues
protected java.util.Map<java.lang.String,CachedData> returnValues
-
currentReturnKey
private java.lang.String currentReturnKey
-
offset
private int offset
-
assocCommands
protected java.util.List<Command> assocCommands
When MemcachedClient merge get commands,those commans which have the same key will be merged into one get command.The result command's assocCommands contains all these commands with the same key.
-
mergeCommands
protected java.util.Map<java.lang.Object,Command> mergeCommands
-
parseStatus
private TextGetCommand.ParseStatus parseStatus
-
wasFirst
protected boolean wasFirst
-
-
Constructor Detail
-
TextGetCommand
public TextGetCommand(java.lang.String key, byte[] keyBytes, CommandType cmdType, java.util.concurrent.CountDownLatch latch)
-
-
Method Detail
-
getMergeCommands
public final java.util.Map<java.lang.Object,Command> getMergeCommands()
- Specified by:
getMergeCommands
in interfaceMergeCommandsAware
-
setMergeCommands
public final void setMergeCommands(java.util.Map<java.lang.Object,Command> mergeCommands)
- Specified by:
setMergeCommands
in interfaceMergeCommandsAware
-
getAssocCommands
public final java.util.List<Command> getAssocCommands()
- Specified by:
getAssocCommands
in interfaceAssocCommandAware
-
setAssocCommands
public final void setAssocCommands(java.util.List<Command> assocCommands)
- Specified by:
setAssocCommands
in interfaceAssocCommandAware
-
getParseStatus
public TextGetCommand.ParseStatus getParseStatus()
-
setParseStatus
public void setParseStatus(TextGetCommand.ParseStatus parseStatus)
-
decode
public final boolean decode(MemcachedTCPSession session, java.nio.ByteBuffer buffer)
-
getItem
private java.lang.String getItem(java.nio.ByteBuffer buffer, char token, char[] others)
-
isIn
private boolean isIn(byte b, char[] others)
-
getString
private java.lang.String getString(byte[] keyBytes)
-
getReturnValues
public final java.util.Map<java.lang.String,CachedData> getReturnValues()
- Specified by:
getReturnValues
in interfaceMapReturnValueAware
-
setReturnValues
public final void setReturnValues(java.util.Map<java.lang.String,CachedData> returnValues)
-
dispatch
public abstract void dispatch()
-
-