@GwtIncompatible private static class Futures.MappingCheckedFuture<V,X extends java.lang.Exception> extends AbstractCheckedFuture<V,X>
ForwardingListenableFuture.SimpleForwardingListenableFuture<V>
ForwardingFuture.SimpleForwardingFuture<V>
Modifier and Type | Field and Description |
---|---|
(package private) Function<? super java.lang.Exception,X> |
mapper |
Constructor and Description |
---|
MappingCheckedFuture(ListenableFuture<V> delegate,
Function<? super java.lang.Exception,X> mapper) |
Modifier and Type | Method and Description |
---|---|
protected X |
mapException(java.lang.Exception e)
Translates from an
InterruptedException , CancellationException or ExecutionException thrown by get to an exception of type X to be thrown by
checkedGet . |
checkedGet, checkedGet
delegate
addListener
cancel, get, get, isCancelled, isDone
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener
MappingCheckedFuture(ListenableFuture<V> delegate, Function<? super java.lang.Exception,X> mapper)
protected X mapException(java.lang.Exception e)
AbstractCheckedFuture
InterruptedException
, CancellationException
or ExecutionException
thrown by get
to an exception of type X
to be thrown by
checkedGet
. Subclasses must implement this method.
If e
is an InterruptedException
, the calling checkedGet
method has
already restored the interrupt after catching the exception. If an implementation of AbstractCheckedFuture.mapException(Exception)
wishes to swallow the interrupt, it can do so by calling Thread.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.
mapException
in class AbstractCheckedFuture<V,X extends java.lang.Exception>