|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Beta public interface CheckedFuture<V,E extends Exception>
A CheckedFuture
is an extension of Future
that includes
versions of the get
methods that can throw a checked exception and
allows listeners to be attached to the future. This makes it easier to
create a future that executes logic which can throw an exception.
Implementations of this interface must adapt the exceptions thrown by
Future#get()
: CancellationException
,
ExecutionException
and InterruptedException
into the type
specified by the E
type parameter.
This interface also extends the ListenableFuture interface to allow
listeners to be added. This allows the future to be used as a normal
Future
or as an asynchronous callback mechanism as needed. This
allows multiple callbacks to be registered for a particular task, and the
future will guarantee execution of all listeners when the task completes.
Method Summary | |
---|---|
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. |
Methods inherited from interface com.google.common.util.concurrent.ListenableFuture |
---|
addListener |
Methods inherited from interface java.util.concurrent.Future |
---|
cancel, get, get, isCancelled, isDone |
Method Detail |
---|
V checkedGet() throws E extends Exception
Future.get()
that will translate
InterruptedException
, CancellationException
and
ExecutionException
into application-specific exceptions.
E
- on interruption, cancellation or execution exceptions.
E extends Exception
V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, E extends Exception
Future.get(long, TimeUnit)
that will
translate InterruptedException
, CancellationException
and
ExecutionException
into application-specific exceptions. On
timeout this method throws a normal TimeoutException
.
TimeoutException
- if retrieving the result timed out.
E
- on interruption, cancellation or execution exceptions.
E extends Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |