Package com.palantir.atlasdb.futures
Class AtlasFutures
- java.lang.Object
-
- com.palantir.atlasdb.futures.AtlasFutures
-
public final class AtlasFutures extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,R>
com.google.common.util.concurrent.ListenableFuture<Map<T,R>>allAsMap(Map<T,com.google.common.util.concurrent.ListenableFuture<R>> inputToListenableFutureMap, Executor executor)
static <T,R>
com.google.common.util.concurrent.ListenableFuture<Map<T,R>>allOptionalsAsMap(Map<T,com.google.common.util.concurrent.ListenableFuture<Optional<R>>> inputToListenableFutureMap, Executor executor)
Creates a newListenableFuture
whose value is a map containing the values of all its input futures, if all succeed.static FuturesCombiner
futuresCombiner(ExecutorService executorService)
Constructs aFuturesCombiner
implementation which takes ownership of theexecutorService
and callsExecutorService.shutdown()
when close is called on it.static <R> R
getDone(com.google.common.util.concurrent.ListenableFuture<R> resultFuture)
static <R> R
getUnchecked(Future<R> future)
-
-
-
Method Detail
-
futuresCombiner
public static FuturesCombiner futuresCombiner(ExecutorService executorService)
Constructs aFuturesCombiner
implementation which takes ownership of theexecutorService
and callsExecutorService.shutdown()
when close is called on it.- Parameters:
executorService
- to be used to combine the futures- Returns:
- implementation of
FuturesCombiner
-
allOptionalsAsMap
public static <T,R> com.google.common.util.concurrent.ListenableFuture<Map<T,R>> allOptionalsAsMap(Map<T,com.google.common.util.concurrent.ListenableFuture<Optional<R>>> inputToListenableFutureMap, Executor executor)
Creates a newListenableFuture
whose value is a map containing the values of all its input futures, if all succeed. Input key-value pairs for which the input futures resolve toOptional.empty()
are filtered out.- Type Parameters:
T
- type of query inputR
- type of query result- Parameters:
inputToListenableFutureMap
- query input toListenableFuture
of the query result- Returns:
ListenableFuture
of the combined map
-
allAsMap
public static <T,R> com.google.common.util.concurrent.ListenableFuture<Map<T,R>> allAsMap(Map<T,com.google.common.util.concurrent.ListenableFuture<R>> inputToListenableFutureMap, Executor executor)
-
getDone
public static <R> R getDone(com.google.common.util.concurrent.ListenableFuture<R> resultFuture)
-
getUnchecked
public static <R> R getUnchecked(Future<R> future)
-
-