Package org.pipecraft.infra.concurrent
Interface CheckedFuture<V,E extends Exception>
-
- All Superinterfaces:
Future<V>,com.google.common.util.concurrent.ListenableFuture<V>
- All Known Implementing Classes:
AbstractCheckedFuture,CheckedFutureTransformer,ImmediateFuture
public interface CheckedFuture<V,E extends Exception> extends com.google.common.util.concurrent.ListenableFuture<V>ExtendsListenableFutureand adds checkedGet() methods which simplify Future's error handling. This interface is a replacement for Google's deprecated CheckedFuture.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VcheckedGet()A simplified version ofFuture.get()which mapsExecutionExceptionto a more indicative exception typeVcheckedGet(long timeout, TimeUnit unit)A simplified version ofFuture.get(long, TimeUnit)which mapsExecutionExceptionto a more indicative exception type
-
-
-
Method Detail
-
checkedGet
V checkedGet() throws InterruptedException, E extends Exception
A simplified version ofFuture.get()which mapsExecutionExceptionto a more indicative exception type- Returns:
- the result of executing the future.
- Throws:
InterruptedException- When the waiting for completion is interruptedE- when an execution exception is detected and mappedCancellationException- if the computation was cancelledE extends Exception
-
checkedGet
V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException, E extends Exception
A simplified version ofFuture.get(long, TimeUnit)which mapsExecutionExceptionto a more indicative exception type- Parameters:
timeout- The timeout to applyunit- The time unit of the timeout parameter- Returns:
- the result of executing the future.
- Throws:
TimeoutException- In case that the timeout period elapsesInterruptedException- When the waiting for completion is interruptedE- when an execution exception is detected and mappedCancellationException- if the computation was cancelledE extends Exception
-
-