public final class Futures extends Object
| Constructor and Description |
|---|
Futures() |
| Modifier and Type | Method and Description |
|---|---|
static <T> CompletableFuture<T> |
asyncFuture(CompletableFuture<T> future,
Executor executor)
Returns a wrapped future that will be completed on the given executor.
|
static <T> CompletableFuture<T> |
completedFuture(T result)
Creates a future that is synchronously completed.
|
static <T> CompletableFuture<T> |
completedFutureAsync(T result,
Executor executor)
Creates a future that is asynchronously completed.
|
static <T> CompletableFuture<T> |
exceptionalFuture(Throwable t)
Creates a future that is synchronously completed exceptionally.
|
static <T> CompletableFuture<T> |
exceptionalFutureAsync(Throwable t,
Executor executor)
Creates a future that is asynchronously completed exceptionally.
|
static <T> CompletableFuture<T> |
orderedFuture()
Returns a future that completes callbacks in add order.
|
public static <T> CompletableFuture<T> completedFuture(T result)
result - The future result.public static <T> CompletableFuture<T> completedFutureAsync(T result, Executor executor)
result - The future result.executor - The executor on which to complete the future.public static <T> CompletableFuture<T> exceptionalFuture(Throwable t)
t - The future exception.public static <T> CompletableFuture<T> exceptionalFutureAsync(Throwable t, Executor executor)
t - The future exception.executor - The executor on which to complete the future.public static <T> CompletableFuture<T> orderedFuture()
T - future value typepublic static <T> CompletableFuture<T> asyncFuture(CompletableFuture<T> future, Executor executor)
T - the future value typefuture - the future to be completed on the given executorexecutor - the executor with which to complete the futureCopyright © 2013–2018. All rights reserved.