Class AbstractCheckedFuture<T,E extends Exception>
java.lang.Object
org.apache.drill.shaded.guava.com.google.common.collect.ForwardingObject
org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingFuture<V>
org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture<V>
org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<T>
org.apache.drill.common.concurrent.AbstractCheckedFuture<T,E>
- All Implemented Interfaces:
Future<T>
,CheckedFuture<T,
,E> org.apache.drill.shaded.guava.com.google.common.util.concurrent.ListenableFuture<T>
- Direct Known Subclasses:
RpcCheckedFuture
public abstract class AbstractCheckedFuture<T,E extends Exception>
extends org.apache.drill.shaded.guava.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 org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture
org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture<V extends Object>
Nested classes/interfaces inherited from class org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingFuture
org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingFuture.SimpleForwardingFuture<V extends Object>
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractCheckedFuture
(org.apache.drill.shaded.guava.com.google.common.util.concurrent.ListenableFuture<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionException checking version ofFuture.get()
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.checkedGet
(long timeout, TimeUnit unit) Exception checking version ofFuture.get(long, TimeUnit)
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.protected abstract E
Translates from anInterruptedException
,CancellationException
orExecutionException
thrown byget
to an exception of typeX
to be thrown bycheckedGet
.Methods inherited from class org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture
delegate
Methods inherited from class org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingListenableFuture
addListener
Methods inherited from class org.apache.drill.shaded.guava.com.google.common.util.concurrent.ForwardingFuture
cancel, get, get, isCancelled, isDone
Methods inherited from class org.apache.drill.shaded.guava.com.google.common.collect.ForwardingObject
toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.drill.shaded.guava.com.google.common.util.concurrent.ListenableFuture
addListener
-
Constructor Details
-
AbstractCheckedFuture
protected AbstractCheckedFuture(org.apache.drill.shaded.guava.com.google.common.util.concurrent.ListenableFuture<T> delegate)
-
-
Method Details
-
mapException
Translates from anInterruptedException
,CancellationException
orExecutionException
thrown byget
to an exception of typeX
to be thrown bycheckedGet
. Subclasses must implement this method.If
e
is anInterruptedException
, the callingcheckedGet
method 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
RuntimeException
to allow creating a CheckedFuture that throws both checked and unchecked exceptions. -
checkedGet
Exception checking version ofFuture.get()
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.- Specified by:
checkedGet
in 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
,CancellationException
andExecutionException
into application-specific exceptions. On timeout this method throws a normalTimeoutException
.- Specified by:
checkedGet
in 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.
-