-
public interface AsyncHelpers
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T> java.util.concurrent.CompletionStage<T>
applyExceptionally(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,java.lang.Throwable> mapper)
Applies a function on failure to produce another failure.static <T> java.util.concurrent.CompletionStage<T>
composeExceptionally(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,java.util.concurrent.CompletionStage<T>> mapper)
Composes the given completion stage on failure.static <T> java.util.concurrent.CompletionStage<T>
failedFuture(java.lang.Throwable t)
Creates a failed completion stage.
-
-
-
Method Detail
-
failedFuture
static <T> java.util.concurrent.CompletionStage<T> failedFuture(java.lang.Throwable t)
Creates a failed completion stage.- Type Parameters:
T
- the emitted type- Parameters:
t
- the failure- Returns:
- the failed completion stage.
-
applyExceptionally
static <T> java.util.concurrent.CompletionStage<T> applyExceptionally(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,java.lang.Throwable> mapper)
Applies a function on failure to produce another failure.- Type Parameters:
T
- the type of emitted item- Parameters:
upstream
- the upstream stage.mapper
- the mapper- Returns:
- the mapped completion stage.
-
composeExceptionally
static <T> java.util.concurrent.CompletionStage<T> composeExceptionally(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,java.util.concurrent.CompletionStage<T>> mapper)
Composes the given completion stage on failure.- Type Parameters:
T
- the type of emitted item- Parameters:
upstream
- the upstream stagemapper
- the mapper- Returns:
- the composed completion stage.
-
-