U - the callback result typeT - the future result type obtained after converting the callback resultpublic abstract class ConvertingFutureCallback<U,T> extends Object implements Callback<U>, Future<T>
Callback that also implements the Future interface. This allows for
operations like waiting until the callback is completed via onCompletion(Throwable, Object). The result
from the callback can be converted by concrete implementations of this class before being retrieved via
Future.get().| Constructor and Description |
|---|
ConvertingFutureCallback() |
ConvertingFutureCallback(Callback<T> underlying) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
abstract T |
convert(U result) |
T |
get() |
T |
get(long l,
TimeUnit timeUnit) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
onCompletion(Throwable error,
U result)
Invoked upon completion of the operation.
|
public void onCompletion(Throwable error, U result)
CallbackonCompletion in interface Callback<U>error - the error that caused the operation to fail, or null if no error occurredresult - the return value, or null if the operation failedpublic boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<T>public T get() throws InterruptedException, ExecutionException
get in interface Future<T>InterruptedExceptionExecutionExceptionpublic T get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutException