K - Key type.V - Value type.T - Command output type.public class Command<K,V,T> extends Object implements RedisCommand<K,V,T>
command type, arguments and an optional
output. All successfully executed commands will eventually return a CommandOutput object.| Modifier and Type | Field and Description |
|---|---|
protected CommandArgs<K,V> |
args |
protected Throwable |
exception |
protected CommandOutput<K,V,T> |
output |
protected static byte |
ST_CANCELLED |
protected static byte |
ST_COMPLETED |
protected static byte |
ST_INITIAL |
protected byte |
status |
| Constructor and Description |
|---|
Command(ProtocolKeyword type,
CommandOutput<K,V,T> output)
Create a new command with the supplied type.
|
Command(ProtocolKeyword type,
CommandOutput<K,V,T> output,
CommandArgs<K,V> args)
Create a new command with the supplied type and args.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel a command.
|
void |
complete()
Mark this command complete and notify all waiting threads.
|
boolean |
completeExceptionally(Throwable throwable) |
void |
encode(ByteBuf buf)
Encode and write this command to the supplied buffer using the new Unified
Request Protocol.
|
T |
get() |
CommandArgs<K,V> |
getArgs() |
String |
getError() |
CommandOutput<K,V,T> |
getOutput()
Get the object that holds this command's output.
|
ProtocolKeyword |
getType() |
boolean |
isCancelled() |
boolean |
isDone() |
void |
setOutput(CommandOutput<K,V,T> output)
Set a new output.
|
String |
toString() |
protected static final byte ST_INITIAL
protected static final byte ST_COMPLETED
protected static final byte ST_CANCELLED
protected CommandArgs<K,V> args
protected CommandOutput<K,V,T> output
protected Throwable exception
protected volatile byte status
public Command(ProtocolKeyword type, CommandOutput<K,V,T> output)
type - Command type, must not be null.output - Command output, can be null.public Command(ProtocolKeyword type, CommandOutput<K,V,T> output, CommandArgs<K,V> args)
type - Command type, must not be null.output - Command output, can be null.args - Command args, can be nullpublic CommandOutput<K,V,T> getOutput()
getOutput in interface RedisCommand<K,V,T>public boolean completeExceptionally(Throwable throwable)
completeExceptionally in interface RedisCommand<K,V,T>throwable - the exceptiontrue if this invocation caused this CompletableFuture to transition to a completed state, else
falsepublic void complete()
complete in interface RedisCommand<K,V,T>public void cancel()
RedisCommandcancel in interface RedisCommand<K,V,T>public void encode(ByteBuf buf)
encode in interface RedisCommand<K,V,T>buf - Buffer to write to.public String getError()
public CommandArgs<K,V> getArgs()
getArgs in interface RedisCommand<K,V,T>public T get()
public void setOutput(CommandOutput<K,V,T> output)
RedisCommandsetOutput in interface RedisCommand<K,V,T>output - the new command outputpublic ProtocolKeyword getType()
getType in interface RedisCommand<K,V,T>public boolean isCancelled()
isCancelled in interface RedisCommand<K,V,T>public boolean isDone()
isDone in interface RedisCommand<K,V,T>Copyright © 2019 lettuce.io. All rights reserved.