|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avro.ipc.CallFuture<T>
public class CallFuture<T>
A Future implementation for RPCs.
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CallFuture()
public CallFuture(Callback<T> chainedCallback)
chainedCallback - the chained Callback to set.| Method Detail |
|---|
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)
cancel in interface Future<T>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.public boolean isDone()
isDone in interface Future<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||