public abstract class DelegatingFuture<V> extends Wrapper<Future<V>> implements Future<V>
Future by forwarding all required methods to a
delegate future object.result
and exception outcomes.
Although this class does implement all required methods of Future it is still declared as an
abstract class.
This is because it does not provide any value in itself.
| Modifier | Constructor and Description |
|---|---|
protected |
DelegatingFuture(Future<V> delegate) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
protected ExecutionException |
wrapException(ExecutionException exception)
Overridable method to wrap the
ExecutionException after it has been thrown from the delegate future. |
protected V |
wrapResult(V result)
Overridable method to wrap the result after it has been obtained from the delegate future.
|
protected V wrapResult(V result)
result - The original result from the delegate.protected ExecutionException wrapException(ExecutionException exception)
ExecutionException after it has been thrown from the delegate future.exception - The original execution exception from the delegate.public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<V>public V get() throws InterruptedException, ExecutionException
get in interface Future<V>InterruptedExceptionExecutionExceptionpublic V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>InterruptedExceptionExecutionExceptionTimeoutExceptionCopyright © 2016–2017 Talsma ICT. All rights reserved.