public class FutureUtils extends Object
Future and CompletableFuture.| Modifier and Type | Class and Description |
|---|---|
static interface |
FutureUtils.ConjunctFuture<T>
A future that is complete once multiple other futures completed.
|
static class |
FutureUtils.RetryException |
| Constructor and Description |
|---|
FutureUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> FutureUtils.ConjunctFuture<Collection<T>> |
combineAll(Collection<? extends Future<? extends T>> futures)
Creates a future that is complete once multiple other futures completed.
|
static <T> Future<T> |
retry(Callable<Future<T>> operation,
int retries,
Executor executor)
Retry the given operation the given number of times in case of a failure.
|
static FutureUtils.ConjunctFuture<Void> |
waitForAll(Collection<? extends Future<?>> futures)
Creates a future that is complete once all of the given futures have completed.
|
public static <T> Future<T> retry(Callable<Future<T>> operation, int retries, Executor executor)
T - type of the resultoperation - to executedretries - if the operation failedexecutor - to use to run the futuresFutureUtils.RetryExceptionpublic static <T> FutureUtils.ConjunctFuture<Collection<T>> combineAll(Collection<? extends Future<? extends T>> futures)
The ConjunctFuture gives access to how many Futures in the conjunction have already
completed successfully, via FutureUtils.ConjunctFuture.getNumFuturesCompleted().
futures - The futures that make up the conjunction. No null entries are allowed.public static FutureUtils.ConjunctFuture<Void> waitForAll(Collection<? extends Future<?>> futures)
The ConjunctFuture gives access to how many Futures have already
completed successfully, via FutureUtils.ConjunctFuture.getNumFuturesCompleted().
futures - The futures to wait on. No null entries are allowed.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.