Constructor and Description |
---|
CallFuture()
Creates a CallFuture.
|
CallFuture(Callback<T> chainedCallback)
Creates a CallFuture with a chained Callback which will be invoked
when this CallFuture's Callback methods are invoked.
|
Modifier and Type | Method and Description |
---|---|
void |
await()
Waits for the CallFuture to complete without returning the result.
|
void |
await(long timeout,
TimeUnit unit)
Waits for the CallFuture to complete without returning the result.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
Throwable |
getError()
Gets the error that was thrown during RPC execution.
|
T |
getResult()
Gets the value of the RPC result without blocking.
|
void |
handleError(Throwable error)
Sets an error thrown during RPC execution, and unblocks all threads waiting
on
get() or get(long, TimeUnit) . |
void |
handleResult(T result)
Sets the RPC response, and unblocks all threads waiting on
get()
or get(long, TimeUnit) . |
boolean |
isCancelled() |
boolean |
isDone() |
public void handleResult(T result)
get()
or get(long, TimeUnit)
.handleResult
in interface Callback<T>
result
- the RPC result to set.public void handleError(Throwable error)
get()
or get(long, TimeUnit)
.handleError
in interface Callback<T>
error
- the RPC error to set.public T getResult()
get()
or get(long, TimeUnit)
is usually
preferred because these methods block until the result is available or
an error occurs.public Throwable getError()
get()
or get(long, TimeUnit)
should be called
first because these methods block until the RPC has completed.public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<T>
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public void await() throws InterruptedException
InterruptedException
- if interrupted.public void await(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
timeout
- the maximum time to wait.unit
- the time unit of the timeout argument.InterruptedException
- if interrupted.TimeoutException
- if the wait timed out.Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.