public final class ListenableFutures extends Object
Futures
Modifier and Type | Method and Description |
---|---|
static <V> void |
addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future,
org.slf4j.Logger logger,
String message)
Adds a callback to a ListenableFuture which logs any failures.
|
static <V> void |
addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future,
org.slf4j.Logger logger,
String format,
Object... arguments) |
static <V> void |
addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future,
org.slf4j.Logger logger,
String format,
Object arg) |
static <V,E extends Exception> |
checkedGet(com.google.common.util.concurrent.ListenableFuture<V> future,
Function<? super Exception,E> mapper) |
static <V,E extends Exception> |
checkedGet(com.google.common.util.concurrent.ListenableFuture<V> future,
Function<? super Exception,E> mapper,
long timeout,
TimeUnit unit) |
static <V> CompletionStage<V> |
toCompletionStage(com.google.common.util.concurrent.ListenableFuture<V> future)
Converts a Guava ListenableFuture to a Java 8 CompletionStage.
|
public static <V> CompletionStage<V> toCompletionStage(com.google.common.util.concurrent.ListenableFuture<V> future)
CompletionStages.toListenableFuture(CompletionStage)
for the inverse function of this.
and CompletableFutures.toListenableFuture(java.util.concurrent.CompletableFuture)
for a related function.public static <V> void addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future, org.slf4j.Logger logger, String message)
Instead of using this helper, you should consider directly using
Futures.addCallback(ListenableFuture, com.google.common.util.concurrent.FutureCallback,
java.util.concurrent.Executor)
to add a callback which does real error recovery in case of a failure instead
of just logging an error, if you can.
public static <V> void addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future, org.slf4j.Logger logger, String format, Object arg)
public static <V> void addErrorLogging(com.google.common.util.concurrent.ListenableFuture<V> future, org.slf4j.Logger logger, String format, Object... arguments)
public static <V,E extends Exception> V checkedGet(com.google.common.util.concurrent.ListenableFuture<V> future, Function<? super Exception,E> mapper) throws E extends Exception
E extends Exception
public static <V,E extends Exception> V checkedGet(com.google.common.util.concurrent.ListenableFuture<V> future, Function<? super Exception,E> mapper, long timeout, TimeUnit unit) throws E extends Exception, TimeoutException
E extends Exception
TimeoutException
Copyright © 2019 OpenDaylight. All rights reserved.