public class PendingRequest extends java.lang.Object implements java.util.concurrent.Future<Response>
Future for parameteric T type Response
used for processing of pipelined responses from the server.
Note that this implementation does NOT support canceling of Requests.
| Modifier and Type | Field and Description |
|---|---|
(package private) byte[][] |
args |
(package private) Command |
cmd
Pending command
|
(package private) Signal |
completion
Used to signal completion of the request
|
private ClientRuntimeException |
cre
if
excepted is true, this will be set to the cause. |
private boolean |
excepted
true if response processor encountered exceptions
|
(package private) Response |
response
awaited response
|
| Constructor and Description |
|---|
PendingRequest(Command cmd) |
PendingRequest(Command cmd,
byte[]... args) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Pipeline does not support canceling of requests -- will always return false.
|
private void |
checkStatus()
Determines if a completed request encountered errors and will throw an
ExecutionException wrapping
the original cause. |
Response |
get() |
Response |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
(package private) Command |
getCommand() |
boolean |
isCancelled()
Pipeline does not support canceling of requests -- will always return false.
|
boolean |
isDone() |
(package private) void |
setCRE(ClientRuntimeException cre)
Signals completion with error -- response will be null
|
(package private) void |
setResponse(Response response)
Signals completion without error.
|
final Signal completion
Response response
final Command cmd
private boolean excepted
private ClientRuntimeException cre
excepted is true, this will be set to the cause.final byte[][] args
public PendingRequest(Command cmd)
public PendingRequest(Command cmd, byte[]... args)
final Command getCommand()
final void setResponse(Response response)
Sets the response, which also signals the completion of this Future
object. When this method is invoked, a call to get()
will immediately return with the response.
response - final void setCRE(ClientRuntimeException cre)
cre - private final void checkStatus()
throws java.util.concurrent.ExecutionException
ExecutionException wrapping
the original cause. Called by the get() methods.java.util.concurrent.ExecutionExceptionpublic Response get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<Response>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic Response get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<Response>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<Response>Future.cancel(boolean)public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<Response>cancel(boolean),
Future.isCancelled()public boolean isDone()
isDone in interface java.util.concurrent.Future<Response>