@ParametersAreNonnullByDefault public final class CompletionStages extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> CompletionStage<T> |
fail(Throwable throwable)
Return a completion stage that is already failed with the supplied
throwable
|
static <T> T |
unsafeBlockAndGet(CompletionStage<T> completionStage,
Function<Throwable,? extends T> onError)
Block and retrieve the value from a
CompletionStage or handle the
associated error. |
static <T> T |
unsafeBlockAndGet(CompletionStage<T> completionStage,
Timeout timeout,
Function<Throwable,? extends T> onError)
Block and retrieve the value from a
CompletionStage or handle the
associated error. |
public static <T> CompletionStage<T> fail(Throwable throwable)
T - The type of the CompletionStagethrowable - The Throwable to completeExceptionally the CompletionStagepublic static <T> T unsafeBlockAndGet(CompletionStage<T> completionStage, Function<Throwable,? extends T> onError)
CompletionStage or handle the
associated error. In general you should avoid calling this method unless
you absolutely have to force a value from the CompletionStage as it will
block.T - The type held inside the CompletionStatecompletionStage - The completionStage that holds the valueonError - Function to be invoked if the forcing of the CompletionStage
failspublic static <T> T unsafeBlockAndGet(CompletionStage<T> completionStage, Timeout timeout, Function<Throwable,? extends T> onError)
CompletionStage or handle the
associated error. In general you should avoid calling this method unless
you absolutely have to force a value from the CompletionStage as it will
block.T - The type held inside the CompletionStatecompletionStage - The completionStage that holds the valuetimeout - How long to wait when retrieving the future valueonError - Function to be invoked if the forcing of the CompletionStage
failsCopyright © 2024 Atlassian. All rights reserved.