public class CompletableFutures extends Object
CompletableFuture futures and our NotifyingNotifiableFuture futures.| Modifier and Type | Field and Description |
|---|---|
static long |
BIG_DELAY_NANOS |
| Constructor and Description |
|---|
CompletableFutures() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
await(CompletableFuture<?> future,
long time,
TimeUnit unit)
It waits until the
CompletableFuture is completed. |
static <T> T |
await(CompletableFuture<T> future)
Wait for a long time until the
CompletableFuture is completed. |
static <T> CompletableFuture<T> |
completedExceptionFuture(Throwable ex) |
static <T> void |
connect(NotifyingNotifiableFuture<T> sink,
CompletableFuture<T> source) |
static <K,V> CompletableFuture<Map<K,V>> |
returnEmptyMap() |
static <T> CompletableFuture<List<T>> |
sequence(List<CompletableFuture<T>> futures) |
static <T> CompletableFuture<T> |
toCompletableFuture(NotifyingFuture<T> source) |
public static <K,V> CompletableFuture<Map<K,V>> returnEmptyMap()
public static <T> void connect(NotifyingNotifiableFuture<T> sink, CompletableFuture<T> source)
public static <T> CompletableFuture<T> toCompletableFuture(NotifyingFuture<T> source)
public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures)
public static <T> CompletableFuture<T> completedExceptionFuture(Throwable ex)
public static boolean await(CompletableFuture<?> future, long time, TimeUnit unit) throws InterruptedException
CompletableFuture is completed.
It ignore if the CompletableFuture is completed normally or exceptionally.
future - the CompletableFuture to test.time - the timeout.unit - the timeout unit.true if completed, false if timed out.InterruptedException - if interrupted while waiting.NullPointerException - if future or unit is null.public static <T> T await(CompletableFuture<T> future) throws ExecutionException, InterruptedException
CompletableFuture is completed.T - the return type.future - the CompletableFuture.ExecutionException - if the CompletableFuture completed exceptionally.InterruptedException - if the current thread was interrupted while waiting.Copyright © 2024 JBoss, a division of Red Hat. All rights reserved.