public class CompletionStageUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T,R> java.util.function.Supplier<java.util.concurrent.CompletionStage<R>> |
andThen(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.BiFunction<T,java.lang.Throwable,R> handler)
Returns a composed CompletionStage that first applies the CompletionStage and then applies BiFunction
after to the result. |
static <X extends java.lang.Throwable,T> |
recover(java.util.concurrent.CompletionStage<T> completionStage,
java.lang.Class<X> exceptionType,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a CompletionStage that is recovered from a specific exception.
|
static <T> java.util.concurrent.CompletionStage<T> |
recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a CompletionStage that is recovered from any exception.
|
static <T> java.util.concurrent.CompletionStage<T> |
recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a CompletionStage that is recovered from a specific exception.
|
static <T> java.util.concurrent.CompletionStage<T> |
recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.function.Predicate<T> resultPredicate,
java.util.function.UnaryOperator<T> resultHandler)
Returns a composed CompletionStage that first executes the CompletionStage and optionally recovers from a specific result.
|
static <T,X extends java.lang.Throwable> |
recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.lang.Class<X> exceptionType,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a decorated CompletionStage that is recovered from a specific exception.
|
static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> |
recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a decorated CompletionStage that is recovered from a specific exception.
|
static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> |
recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
Returns a decorated CompletionStage that is recovered from a specific exception.
|
static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> |
recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.Predicate<T> resultPredicate,
java.util.function.UnaryOperator<T> resultHandler)
Returns a composed CompletionStage that first executes the CompletionStage and optionally recovers from a specific result.
|
public static <T> java.util.concurrent.CompletionStage<T> recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStage - the completionStage which should be recovered from any exceptionexceptionHandler - the function applied after callable has failedpublic static <T> java.util.concurrent.CompletionStage<T> recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStage - the completionStage which should be recovered from a certain exceptionexceptionTypes - the specific exception types that should be recoveredexceptionHandler - the function applied after callable has failedpublic static <X extends java.lang.Throwable,T> java.util.concurrent.CompletionStage<T> recover(java.util.concurrent.CompletionStage<T> completionStage,
java.lang.Class<X> exceptionType,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStage - the completionStage which should be recovered from a certain exceptionexceptionType - the specific exception type that should be recoveredexceptionHandler - the function applied after callable has failedpublic static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStageSupplier - a supplier of the completionStage which should be recovered from a certain exceptionexceptionHandler - the function applied after callable has failedpublic static <T,X extends java.lang.Throwable> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.lang.Class<X> exceptionType,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStageSupplier - a supplier of the completionStage which should be recovered from a certain exceptionexceptionType - the specific exception type that should be recoveredexceptionHandler - the function applied after callable has failedpublic static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.List<java.lang.Class<? extends java.lang.Throwable>> exceptionTypes,
java.util.function.Function<java.lang.Throwable,T> exceptionHandler)
completionStageSupplier - a supplier of the completionStage which should be recovered from a certain exceptionexceptionTypes - the specific exception types that should be recoveredexceptionHandler - the function applied after callable has failedpublic static <T> java.util.concurrent.CompletionStage<T> recover(java.util.concurrent.CompletionStage<T> completionStage,
java.util.function.Predicate<T> resultPredicate,
java.util.function.UnaryOperator<T> resultHandler)
T - return type of aftercompletionStage - the completionStage which should be recovered from a certain exceptionresultPredicate - the result predicateresultHandler - the result handlerpublic static <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> recover(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.Predicate<T> resultPredicate,
java.util.function.UnaryOperator<T> resultHandler)
T - return type of aftercompletionStageSupplier - the CompletionStage supplierresultPredicate - the result predicateresultHandler - the result handlerpublic static <T,R> java.util.function.Supplier<java.util.concurrent.CompletionStage<R>> andThen(java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> completionStageSupplier,
java.util.function.BiFunction<T,java.lang.Throwable,R> handler)
after to the result.T - return type of aftercompletionStageSupplier - the CompletionStage supplierhandler - the function applied after supplier