T - Command output type.public class Command<K,V,T> extends Object implements Future<T>
CommandOutput object.| Modifier and Type | Field and Description |
|---|---|
protected CommandArgs<K,V> |
args |
protected CountDownLatch |
latch |
protected CommandOutput<K,V,T> |
output |
CommandType |
type |
| Constructor and Description |
|---|
Command(CommandType type,
CommandOutput<K,V,T> output,
CommandArgs<K,V> args,
boolean multi)
Create a new command with the supplied type and args.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
await(long timeout,
TimeUnit unit)
Wait up to the specified time for the command output to become
available.
|
boolean |
cancel(boolean ignored)
Cancel the command and notify any waiting consumers.
|
void |
complete()
Mark this command complete and notify all waiting threads.
|
T |
get()
Get the command output and if the command hasn't completed
yet, wait until it does.
|
T |
get(long timeout,
TimeUnit unit)
Get the command output and if the command hasn't completed yet,
wait up to the specified time until it does.
|
CommandOutput<K,V,T> |
getOutput()
Get the object that holds this command's output.
|
boolean |
isCancelled()
Check if the command has been cancelled.
|
boolean |
isDone()
Check if the command has completed.
|
protected static void |
writeInt(org.jboss.netty.buffer.ChannelBuffer buf,
int value)
Write the textual value of a positive integer to the supplied buffer.
|
public final CommandType type
protected CommandArgs<K,V> args
protected CommandOutput<K,V,T> output
protected CountDownLatch latch
public Command(CommandType type, CommandOutput<K,V,T> output, CommandArgs<K,V> args, boolean multi)
type - Command type.output - Command output.args - Command args, if any.multi - Flag indicating if MULTI active.public boolean cancel(boolean ignored)
public boolean isCancelled()
isCancelled in interface Future<T>public boolean isDone()
public T get()
public T get(long timeout, TimeUnit unit) throws TimeoutException
get in interface Future<T>timeout - Maximum time to wait for a result.unit - Unit of time for the timeout.TimeoutException - if the wait timed out.public boolean await(long timeout,
TimeUnit unit)
timeout - Maximum time to wait for a result.unit - Unit of time for the timeout.public CommandOutput<K,V,T> getOutput()
public void complete()
protected static void writeInt(org.jboss.netty.buffer.ChannelBuffer buf,
int value)
buf - Buffer to write to.value - Value to write.Copyright © 2025. All rights reserved.