public final class CompletableFutureUtils extends Object
CompletableFuture.| Modifier and Type | Method and Description |
|---|---|
static CompletionException |
errorAsCompletionException(Throwable t)
Wraps the given error in a
CompletionException if necessary. |
static <U> CompletableFuture<U> |
failedFuture(Throwable t)
Convenience method for creating a future that is immediately completed
exceptionally with the given
Throwable. |
public static <U> CompletableFuture<U> failedFuture(Throwable t)
Throwable.
Similar to CompletableFuture#failedFuture which was added in
Java 9.
U - The type of the element.t - The failure.public static CompletionException errorAsCompletionException(Throwable t)
CompletionException if necessary.
Useful if an exception needs to be rethrown from within CompletableFuture.handle(java.util.function.BiFunction) or similar
methods.t - The error.Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.