public class Futures extends Object
| Constructor and Description |
|---|
Futures() |
| Modifier and Type | Method and Description |
|---|---|
static <T> CompletableFuture<T> |
failedFuture(Exception e) |
static <T> T |
getUninterruptibly(CompletionStage<T> stage)
Gets a future without reacting to interruptions: if the current thread is interrupted, the
operation continues until the future completes, and the thread will be re-interrupted upon
completion.
|
static <T> CompletionStage<List<T>> |
sequence(List<CompletionStage<T>> futures)
Returns a future of all the results, or a failed future if any of the inputs fails.
|
public static <T> T getUninterruptibly(CompletionStage<T> stage)
If the future fails with an unchecked exception, it will be rethrown as-is. If it fails with
a checked exception, it will be wrapped in an UncheckedExecutionException.
public static <T> CompletableFuture<T> failedFuture(Exception e)
public static <T> CompletionStage<List<T>> sequence(List<CompletionStage<T>> futures)
Copyright © 2022. All rights reserved.