Class AbstractCheckedFuture<T,E extends Exception>
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.util.concurrent.ForwardingFuture<T>
com.google.common.util.concurrent.ForwardingListenableFuture<T>
com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<T>
org.apache.drill.common.concurrent.AbstractCheckedFuture<T,E>
- All Implemented Interfaces:
com.google.common.util.concurrent.ListenableFuture<T>,Future<T>,CheckedFuture<T,E>
- Direct Known Subclasses:
RpcCheckedFuture
public abstract class AbstractCheckedFuture<T,E extends Exception>
extends com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<T>
implements CheckedFuture<T,E>
A delegating wrapper around a
ListenableFuture that adds support for the checkedGet() and checkedGet(long, TimeUnit) methods.
This class is moved from Guava, since there it was deleted.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.util.concurrent.ForwardingListenableFuture
com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<V>Nested classes/interfaces inherited from class com.google.common.util.concurrent.ForwardingFuture
com.google.common.util.concurrent.ForwardingFuture.SimpleForwardingFuture<V> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCheckedFuture(com.google.common.util.concurrent.ListenableFuture<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionException checking version ofFuture.get()that will translateInterruptedException,CancellationExceptionandExecutionExceptioninto application-specific exceptions.checkedGet(long timeout, TimeUnit unit) Exception checking version ofFuture.get(long, TimeUnit)that will translateInterruptedException,CancellationExceptionandExecutionExceptioninto application-specific exceptions.protected abstract ETranslates from anInterruptedException,CancellationExceptionorExecutionExceptionthrown bygetto an exception of typeXto be thrown bycheckedGet.Methods inherited from class com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture
delegateMethods inherited from class com.google.common.util.concurrent.ForwardingListenableFuture
addListenerMethods inherited from class com.google.common.util.concurrent.ForwardingFuture
cancel, get, get, isCancelled, isDoneMethods inherited from class com.google.common.collect.ForwardingObject
toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.common.util.concurrent.ListenableFuture
addListener
-
Constructor Details
-
AbstractCheckedFuture
-
-
Method Details
-
mapException
Translates from anInterruptedException,CancellationExceptionorExecutionExceptionthrown bygetto an exception of typeXto be thrown bycheckedGet. Subclasses must implement this method.If
eis anInterruptedException, the callingcheckedGetmethod has already restored the interrupt after catching the exception. If an implementation ofmapException(Exception)wishes to swallow the interrupt, it can do so by callingThread.interrupted().Subclasses may choose to throw, rather than return, a subclass of
RuntimeExceptionto allow creating a CheckedFuture that throws both checked and unchecked exceptions. -
checkedGet
Exception checking version ofFuture.get()that will translateInterruptedException,CancellationExceptionandExecutionExceptioninto application-specific exceptions.- Specified by:
checkedGetin interfaceCheckedFuture<T,E extends Exception> - Returns:
- the result of executing the future.
- Throws:
E- on interruption, cancellation or execution exceptions.
-
checkedGet
Exception checking version ofFuture.get(long, TimeUnit)that will translateInterruptedException,CancellationExceptionandExecutionExceptioninto application-specific exceptions. On timeout this method throws a normalTimeoutException.- Specified by:
checkedGetin interfaceCheckedFuture<T,E extends Exception> - Returns:
- the result of executing the future.
- Throws:
TimeoutException- if retrieving the result timed out.E- on interruption, cancellation or execution exceptions.
-