T - the type of this FutureS - the type of the adaptee's Futurepublic abstract class FutureAdapter<T,S> extends Object implements Future<T>
Future parameterized over S into a Future parameterized over T. All methods are delegated to the adaptee, where get() and get(long, TimeUnit) call adapt(Object) on the adaptee's
result.| Modifier | Constructor and Description |
|---|---|
protected |
FutureAdapter(Future<S> adaptee)
Constructs a new
FutureAdapter with the given adaptee. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
adapt(S adapteeResult)
Adapts the given adaptee's result into T.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
protected Future<S> |
getAdaptee()
Returns the adaptee.
|
boolean |
isCancelled() |
boolean |
isDone() |
public 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 timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutExceptionprotected abstract T adapt(S adapteeResult) throws ExecutionException
ExecutionException