public final class CompletionStages extends Object
CompletionStage interface.| Modifier and Type | Method and Description |
|---|---|
static <T> CompletionStage<T> |
exceptionallyAsync(CompletionStage<T> thisStage,
java8.util.function.Function<Throwable,? extends T> fn)
Returns a new CompletionStage that, when
thisStage completes
exceptionally, is executed with thisStage's exception as the
argument to the supplied function, using thisStage's default
asynchronous execution facility. |
static <T> CompletionStage<T> |
exceptionallyAsync(CompletionStage<T> thisStage,
java8.util.function.Function<Throwable,? extends T> fn,
Executor executor)
Returns a new CompletionStage that, when
thisStage completes
exceptionally, is executed with thisStage's exception as the
argument to the supplied function, using the supplied
Executor. |
static <T> CompletionStage<T> |
exceptionallyCompose(CompletionStage<T> thisStage,
java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn)
Returns a new CompletionStage that, when
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception. |
static <T> CompletionStage<T> |
exceptionallyComposeAsync(CompletionStage<T> thisStage,
java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn)
Returns a new CompletionStage that, when
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception, using
thisStage's default asynchronous execution facility. |
static <T> CompletionStage<T> |
exceptionallyComposeAsync(CompletionStage<T> thisStage,
java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn,
Executor executor)
Returns a new CompletionStage that, when
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception, using the
supplied Executor. |
public static <T> CompletionStage<T> exceptionallyAsync(CompletionStage<T> thisStage, java8.util.function.Function<Throwable,? extends T> fn)
thisStage completes
exceptionally, is executed with thisStage's exception as the
argument to the supplied function, using thisStage's default
asynchronous execution facility. Otherwise, if thisStage
completes normally, then the returned stage also completes
normally with the same value.
Implementation Requirements:
The default
implementation invokes CompletionStage.handle(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), relaying to
CompletionStage.handleAsync(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>) on exception, then
CompletionStage.thenCompose(java8.util.function.Function<? super T, ? extends java8.util.concurrent.CompletionStage<U>>) for result.
T - the CompletionStage's element typethisStage - the CompletionStage to decoratefn - the function to use to compute the value of the
returned CompletionStage if the thisStage CompletionStage
completed exceptionallypublic static <T> CompletionStage<T> exceptionallyAsync(CompletionStage<T> thisStage, java8.util.function.Function<Throwable,? extends T> fn, Executor executor)
thisStage completes
exceptionally, is executed with thisStage's exception as the
argument to the supplied function, using the supplied
Executor. Otherwise, if thisStage completes normally, then
the returned stage also completes normally with the same value.
Implementation Requirements:
The default
implementation invokes CompletionStage.handle(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), relaying to
CompletionStage.handleAsync(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>) on exception, then
CompletionStage.thenCompose(java8.util.function.Function<? super T, ? extends java8.util.concurrent.CompletionStage<U>>) for result.
T - the CompletionStage's element typethisStage - the CompletionStage to decoratefn - the function to use to compute the value of the
returned CompletionStage if the thisStage CompletionStage
completed exceptionallyexecutor - the executor to use for asynchronous executionpublic static <T> CompletionStage<T> exceptionallyCompose(CompletionStage<T> thisStage, java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn)
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception.
Implementation Requirements:
The default
implementation invokes CompletionStage.handle(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), invoking the
given function on exception, then CompletionStage.thenCompose(java8.util.function.Function<? super T, ? extends java8.util.concurrent.CompletionStage<U>>)
for result.
T - the CompletionStage's element typethisStage - the CompletionStage to compose withfn - the function to use to compute the returned
CompletionStage if the thisStage CompletionStage completed
exceptionallypublic static <T> CompletionStage<T> exceptionallyComposeAsync(CompletionStage<T> thisStage, java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn)
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception, using
thisStage's default asynchronous execution facility.
Implementation Requirements:
The default
implementation invokes CompletionStage.handle(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), relaying to
CompletionStage.handleAsync(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>) on exception, then
CompletionStage.thenCompose(java8.util.function.Function<? super T, ? extends java8.util.concurrent.CompletionStage<U>>) for result.
T - the CompletionStage's element typethisStage - the CompletionStage to compose withfn - the function to use to compute the returned
CompletionStage if the thisStage CompletionStage completed
exceptionallypublic static <T> CompletionStage<T> exceptionallyComposeAsync(CompletionStage<T> thisStage, java8.util.function.Function<Throwable,? extends CompletionStage<T>> fn, Executor executor)
thisStage completes
exceptionally, is composed using the results of the supplied
function applied to thisStage's exception, using the
supplied Executor.
Implementation Requirements:
The default
implementation invokes CompletionStage.handle(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), relaying to
CompletionStage.handleAsync(java8.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>) on exception, then
CompletionStage.thenCompose(java8.util.function.Function<? super T, ? extends java8.util.concurrent.CompletionStage<U>>) for result.
T - the CompletionStage's element typethisStage - the CompletionStage to compose withfn - the function to use to compute the returned
CompletionStage if the thisStage CompletionStage completed
exceptionallyexecutor - the executor to use for asynchronous executionCopyright © 2019. All rights reserved.