public final class CompletionStages extends Object
CompletionStage.| Modifier and Type | Method and Description |
|---|---|
static <T> CompletionStage<List<T>> |
allOf(Collection<? extends CompletionStage<List<T>>> stages)
Returns a completion stage, which is complete when all the completion stages are complete.
|
static <T> CompletionStage<T> |
timeoutAfter(long delay,
TimeUnit unit)
Creates a completion stage, which times out after the specified time, i.e. it completes exceptionally with a
TimeoutException. |
static <T> CompletionStage<T> |
timeoutAfter(long delay,
TimeUnit unit,
Supplier<Throwable> throwableSupplier)
Creates a completion stage, which times out after the specified time, i.e. it completes exceptionally with the supplied exception.
|
static <T> CompletionStage<T> |
withFallback(CompletionStage<T> stage,
BiFunction<CompletionStage<T>,Throwable,? extends CompletionStage<T>> fallback)
Creates a new completion stage which uses a fallback stage in case the primary stage completes exceptionally.
|
public static <T> CompletionStage<T> withFallback(CompletionStage<T> stage, BiFunction<CompletionStage<T>,Throwable,? extends CompletionStage<T>> fallback)
T - The type.stage - The primary stage.fallback - A function, which returns a fallback stage, in case the primary one fails exceptionally.public static <T> CompletionStage<List<T>> allOf(Collection<? extends CompletionStage<List<T>>> stages)
T - The type.stages - The stages.public static <T> CompletionStage<T> timeoutAfter(long delay, TimeUnit unit)
TimeoutException.T - The type.delay - The delay.unit - The time unit.public static <T> CompletionStage<T> timeoutAfter(long delay, TimeUnit unit, Supplier<Throwable> throwableSupplier)
T - The type.delay - The delay.unit - The time unit.throwableSupplier - The supplier for an exception which occurs on timeout.Copyright © 2014–2018 XMPP.rocks. All rights reserved.