V
- The result type returned by this Future's get methodX
- The checked exception typepublic final class MappingCheckedFuture<V,X extends Exception>
extends com.google.common.util.concurrent.AbstractCheckedFuture<V,X>
get
methods
that the checkedGet
methods provide.
For CancellationException
and InterruptedException
, the specified exception mapper
is invoked to translate them to the checked exception type.
For ExecutionException
, the mapper is invoked to translate the cause to the checked exception
and a new ExecutionException is thrown with the translated cause.
Modifier and Type | Method and Description |
---|---|
static <V,X extends Exception> |
create(com.google.common.util.concurrent.ListenableFuture<V> delegate,
Function<Exception,X> mapper)
Creates a new
MappingCheckedFuture that wraps the given ListenableFuture
delegate. |
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
protected X |
mapException(Exception e) |
checkedGet, checkedGet
delegate
addListener
cancel, isCancelled, isDone
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
cancel, isCancelled, isDone
public static <V,X extends Exception> MappingCheckedFuture<V,X> create(com.google.common.util.concurrent.ListenableFuture<V> delegate, Function<Exception,X> mapper)
MappingCheckedFuture
that wraps the given ListenableFuture
delegate.delegate
- the ListenableFuture
to wrapmapper
- the mapping Function
used to translate exceptions from the delegateMappingCheckedFuture
public V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
get
in class com.google.common.util.concurrent.ForwardingFuture<V>
InterruptedException
ExecutionException
public V get(long timeout, @Nonnull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
get
in class com.google.common.util.concurrent.ForwardingFuture<V>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2019 OpenDaylight. All rights reserved.