V
- The result type returned by this Future's get
methodX
- The type of the Exception thrown by the Future's checkedGet
methodCheckedFuture
cannot properly support the chained operations that are the
primary goal of ListenableFuture
. CheckedFuture
also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture
can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend that
most people use ListenableFuture
and perform any exception wrapping themselves. This
class is scheduled for removal from Guava in February 2018.@Beta @Deprecated @GwtIncompatible public abstract class ForwardingCheckedFuture<V,X extends Exception> extends ForwardingListenableFuture<V> implements CheckedFuture<V,X>
Most subclasses can simply extend ForwardingCheckedFuture.SimpleForwardingCheckedFuture
.
Modifier and Type | Class and Description |
---|---|
static class |
ForwardingCheckedFuture.SimpleForwardingCheckedFuture<V,X extends Exception>
Deprecated.
CheckedFuture cannot properly support the chained operations that are the
primary goal of ListenableFuture . CheckedFuture also encourages users to
rethrow exceptions from one thread in another thread, producing misleading stack traces.
Additionally, it has a surprising policy about which exceptions to map and which to leave
untouched. Guava users who want a CheckedFuture can fork the classes for their own
use, possibly specializing them to the particular exception type they use. We recommend
that most people use ListenableFuture and perform any exception wrapping
themselves. This class is scheduled for removal from Guava in February 2018. |
ForwardingListenableFuture.SimpleForwardingListenableFuture<V>
ForwardingFuture.SimpleForwardingFuture<V>
Constructor and Description |
---|
ForwardingCheckedFuture()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
V |
checkedGet()
Deprecated.
Exception checking version of
Future.get() that will translate InterruptedException , CancellationException and ExecutionException into
application-specific exceptions. |
V |
checkedGet(long timeout,
TimeUnit unit)
Deprecated.
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()
Deprecated.
Returns the backing delegate instance that methods are forwarded to.
|
addListener
cancel, get, get, isCancelled, isDone
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener
public ForwardingCheckedFuture()
@CanIgnoreReturnValue public V checkedGet() throws X extends Exception
CheckedFuture
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 Exception
@CanIgnoreReturnValue public V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, X extends Exception
CheckedFuture
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 Exception
protected abstract CheckedFuture<V,X> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply the
instance being decorated.delegate
in class ForwardingListenableFuture<V>
Copyright © 2010–2017. All rights reserved.