public class FutureUtils extends Object
CompletableFuture
.Constructor and Description |
---|
FutureUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> CompletableFuture<T> |
completedExceptionally(Throwable cause)
Returns an exceptionally completed
CompletableFuture . |
static <T> void |
doForward(T value,
Throwable throwable,
CompletableFuture<T> target)
Completes the given future with either the given value or throwable, depending on which
parameter is not null.
|
static <T> void |
forward(CompletableFuture<T> source,
CompletableFuture<T> target)
Forwards the value from the source future to the target future.
|
public static <T> CompletableFuture<T> completedExceptionally(Throwable cause)
CompletableFuture
.T
- type of the futurecause
- to complete the future withpublic static <T> void forward(CompletableFuture<T> source, CompletableFuture<T> target)
T
- type of the valuesource
- future to forward the value fromtarget
- future to forward the value topublic static <T> void doForward(@Nullable T value, @Nullable Throwable throwable, CompletableFuture<T> target)
T
- completed futurevalue
- value with which the future should be completedthrowable
- throwable with which the future should be completed exceptionallytarget
- future to completeCopyright © 2023–2024 The Apache Software Foundation. All rights reserved.