V - The result type returned by this Future’s get methodX - The type of the Exception thrown by the Future’s checkedGet method@Beta public abstract class ForwardingCheckedFuture<V,X extends Exception> extends ForwardingListenableFuture<V> implements CheckedFuture<V,X>
A future which forwards all its method calls to another future. Subclasses should override one or more methods to modify the behavior of the backing future as desired per the decorator pattern.
Most subclasses can simply extend ForwardingCheckedFuture.SimpleForwardingCheckedFuture.
| Modifier and Type | Class and Description |
|---|---|
static class |
ForwardingCheckedFuture.SimpleForwardingCheckedFuture<V,X extends Exception>
A simplified version of
ForwardingCheckedFuture where subclasses can pass in an already constructed CheckedFuture as the delegate. |
ForwardingListenableFuture.SimpleForwardingListenableFuture<V>ForwardingFuture.SimpleForwardingFuture<V>| Constructor and Description |
|---|
ForwardingCheckedFuture() |
| Modifier and Type | Method and Description |
|---|---|
V |
checkedGet()
Exception checking version of
Future.get() that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions. |
V |
checkedGet(long timeout,
TimeUnit unit)
Exception checking version of
Future.get(long, TimeUnit) that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions. |
protected abstract CheckedFuture<V,X> |
delegate() |
addListenercancel, get, get, isCancelled, isDonetoStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListenerpublic V checkedGet() throws X extends Exception
CheckedFutureException checking version of Future.get() that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions.
checkedGet in interface CheckedFuture<V,X extends Exception>X - on interruption, cancellation or execution exceptions.X extends Exceptionpublic V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, X extends Exception
CheckedFutureException checking version of Future.get(long, TimeUnit) that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions. On timeout this method throws a normal TimeoutException.
checkedGet in interface CheckedFuture<V,X extends Exception>TimeoutException - if retrieving the result timed out.X - on interruption, cancellation or execution exceptions.X extends Exceptionprotected abstract CheckedFuture<V,X> delegate()
delegate in class ForwardingListenableFuture<V>