@Beta public interface CheckedFuture<V,X extends Exception> extends ListenableFuture<V>
ListenableFuturethat includes versions of the
getmethods that can throw a checked exception. This makes it easier to create a future that executes logic which can throw an exception.
A common implementation is
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.
For a simpler alternative to CheckedFuture, consider accessing Future
|Modifier and Type||Method and Description|
V checkedGet() throws X extends Exception
Future.get()that will translate
ExecutionExceptioninto application-specific exceptions.
V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, X extends Exception
Future.get(long, TimeUnit)that will translate
ExecutionExceptioninto application-specific exceptions. On timeout this method throws a normal
Copyright © 2010-2013. All Rights Reserved.