|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.lambdaworks.redis.protocol.Command<K,V,T>
T - Command output type.public class Command<K,V,T>
A redis command and its result. All successfully executed commands will
eventually return a CommandOutput object.
| Field Summary | |
|---|---|
protected CommandArgs<K,V> |
args
|
protected CountDownLatch |
latch
|
protected CommandOutput<K,V,T> |
output
|
CommandType |
type
|
| Constructor Summary | |
|---|---|
Command(CommandType type,
CommandOutput<K,V,T> output,
CommandArgs<K,V> args,
boolean multi)
Create a new command with the supplied type and args. |
|
| Method Summary | |
|---|---|
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(ChannelBuffer buf,
int value)
Write the textual value of a positive integer to the supplied buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final CommandType type
protected CommandArgs<K,V> args
protected CommandOutput<K,V,T> output
protected CountDownLatch latch
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public boolean cancel(boolean ignored)
cancel in interface Future<T>ignored - Ignored parameter.
public boolean isCancelled()
isCancelled in interface Future<T>public boolean isDone()
isDone in interface Future<T>public T get()
get in interface Future<T>
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(ChannelBuffer buf,
int value)
buf - Buffer to write to.value - Value to write.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||