Class CompletableFutureUtils
CompletableFuture.- Author:
- Jerry Lee (oldratlee at gmail dot com), HuHao (995483610 at qq dot com), Eric Lin (linqinghua4 at gmail dot com)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CompletableFuture<Void> acceptEitherSuccess(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied action.static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed using the default executor of parameter cfThis, with the corresponding result as argument to the supplied action.static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new CompletableFuture that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied action.static CompletableFuture<Void> allFailFastOf(CompletionStage<?>... cfs) Returns a new CompletableFuture that is completed normally when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause.static CompletableFuture<Void> allOf(CompletionStage<?>... cfs) Returns a new CompletableFuture that is completed when all the given stages complete; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause.static <T> CompletableFuture<List<T>> allResultsFailFastOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause.static <T> CompletableFuture<List<T>> allResultsOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause.static <T> CompletableFuture<List<T>> allSuccessResultsOf(T valueIfFailed, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete; The list of results is in the same order as the input list, and if any of given stages complete exceptionally, their corresponding position will containvalueIfFailed(which is indistinguishable from the stage having a successful value ofvalueIfFailed).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> allSuccessTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> allSuccessTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> allSuccessTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> allSuccessTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> allTupleFailFastOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallResultsFailFastOf(CompletionStage[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> allTupleFailFastOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallResultsFailFastOf(CompletionStage[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> allTupleFailFastOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallResultsFailFastOf(CompletionStage[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> allTupleFailFastOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallResultsFailFastOf(CompletionStage[]).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallResultsOf(CompletionStage[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallResultsOf(CompletionStage[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallResultsOf(CompletionStage[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallResultsOf(CompletionStage[]).static <T> CompletableFuture<T> anyOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed with the same successful result or exception of any of the given stages when one stage completes.static <T> CompletableFuture<T> anySuccessOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that completed normally when any of the given stages complete normally, with the same result; Otherwise, when all the given stages complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given stages as its cause.static <T,U> CompletableFuture <U> applyToEitherSuccess(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied function.static <T,U> CompletableFuture <U> applyToEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn) Returns a new CompletableFuture that, when either given stage success, is executed using the default executor of parameter cfThis, with the corresponding result as argument to the supplied function.static <T,U> CompletableFuture <U> applyToEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn, Executor executor) Returns a new CompletableFuture that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied function.static <T,X extends Throwable, C extends CompletionStage<? super T>>
CReturns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function.static <T,X extends Throwable, C extends CompletionStage<? super T>>
CcatchingAsync(C cfThis, Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function, using the default executor of parameter the given stage.static <T,X extends Throwable, C extends CompletionStage<? super T>>
CcatchingAsync(C cfThis, Class<X> exceptionType, Function<? super X, ? extends T> fallback, Executor executor) Returns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function, using the supplied Executor.static <T,X extends Throwable, C extends CompletionStage<? super T>>
CcatchingCompose(C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis).static <T,X extends Throwable, C extends CompletionStage<? super T>>
CcatchingComposeAsync(C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis), using the default executor of parameter the given stage.static <T,X extends Throwable, C extends CompletionStage<? super T>>
CcatchingComposeAsync(C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis), using the supplied Executor.static <T,C extends CompletableFuture<? super T>>
CcffuCompleteOnTimeout(C cfThis, T value, long timeout, TimeUnit unit) Returns a new CompletableFuture that is completed normally with the given value when the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.static <T,C extends CompletableFuture<? super T>>
CcffuCompleteOnTimeout(C cfThis, T value, long timeout, TimeUnit unit, Executor executorWhenTimeout) Returns a new CompletableFuture that is completed normally with the given value when the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.static <C extends CompletableFuture<?>>
CcffuOrTimeout(C cfThis, long timeout, TimeUnit unit) Returns a new CompletableFuture that is completed exceptionally with aTimeoutExceptionwhen the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.static <C extends CompletableFuture<?>>
CcffuOrTimeout(C cfThis, long timeout, TimeUnit unit, Executor executorWhenTimeout) Returns a new CompletableFuture that is completed exceptionally with aTimeoutExceptionwhen the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.static <T> CompletableFuture<T>[]completableFutureListToArray(List<CompletableFuture<T>> cfList) Converts inputCompletableFuturelist to CompletableFuture array.static <T,C extends CompletableFuture<? super T>>
CcompleteAsync(C cfThis, Supplier<? extends T> supplier) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor of parameter cfThis.static <T,C extends CompletableFuture<? super T>>
CcompleteAsync(C cfThis, Supplier<? extends T> supplier, Executor executor) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.static <T> CompletionStage<T> completedStage(T value) Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.static <C extends CompletableFuture<?>>
CcompleteExceptionallyAsync(C cfThis, Supplier<? extends Throwable> supplier) If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the default executor of parameter cfThis.static <C extends CompletableFuture<?>>
CcompleteExceptionallyAsync(C cfThis, Supplier<? extends Throwable> supplier, Executor executor) If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the given executor.static <T,C extends CompletableFuture<? super T>>
CcompleteOnTimeout(C cfThis, T value, long timeout, TimeUnit unit) Completes given CompletableFuture with the given value if not otherwise completed before the given timeout.static <T> CompletableFuture<T> copy(CompletableFuture<T> cfThis) Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.static ExecutordefaultExecutor(CompletionStage<?> cfThis) Returns the default Executor of parameter cfThis used for async methods that do not specify an Executor.static ExecutordelayedExecutor(long delay, TimeUnit unit) Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive).static ExecutordelayedExecutor(long delay, TimeUnit unit, Executor executor) Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive).static <T,C extends CompletionStage<? super T>>
CexceptionallyAsync(C cfThis, Function<Throwable, ? extends T> fn) Returns a new CompletableFuture that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the default executor of parameter cfThis.static <T,C extends CompletionStage<? super T>>
CexceptionallyAsync(C cfThis, Function<Throwable, ? extends T> fn, Executor executor) Returns a new CompletableFuture that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor.static <T,C extends CompletionStage<? super T>>
CexceptionallyCompose(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception.static <T,C extends CompletionStage<? super T>>
CexceptionallyComposeAsync(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the default executor of parameter cfThis.static <T,C extends CompletionStage<? super T>>
CexceptionallyComposeAsync(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the supplied Executor.static ThrowableexceptionNow(Future<?> cfThis) Returns the exception thrown by the task, without waiting.static <T> CompletableFuture<T> Returns a new CompletableFuture that is already completed exceptionally with the given exception.static <T> CompletionStage<T> failedStage(Throwable ex) Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.static <T> TgetSuccessNow(CompletableFuture<? extends T> cfThis, T valueIfNotSuccess) Returns the result value if the given stage is completed normally, else returns the given valueIfNotSuccess.static <T> Tjoin(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.static <T> CompletionStage<T> minimalCompletionStage(CompletableFuture<T> cfThis) Returns a new CompletionStage that is completed normally with the same value as given CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage.static <T> CompletableFuture<List<T>> mostSuccessResultsOf(Executor executorWhenTimeout, T valueIfNotSuccess, long timeout, TimeUnit unit, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of the given stages before the given timeout (aka as many results as possible in the given time); The list of results is in the same order as the input list, and if any of given stages complete exceptionally or are incomplete, their corresponding positions will containvalueIfNotSuccess(which is indistinguishable from the stage having a successful value ofvalueIfNotSuccess).static <T> CompletableFuture<List<T>> mostSuccessResultsOf(T valueIfNotSuccess, long timeout, TimeUnit unit, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of the given stages before the given timeout (aka as many results as possible in the given time); The list of results is in the same order as the input list, and if any of given stages complete exceptionally or are incomplete, their corresponding positions will containvalueIfNotSuccess(which is indistinguishable from the stage having a successful value ofvalueIfNotSuccess).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mostSuccessTupleOf(long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mostSuccessTupleOf(long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mostSuccessTupleOf(long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mostSuccessTupleOf(long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mostSuccessTupleOf(Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mostSuccessTupleOf(Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mostSuccessTupleOf(Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mostSuccessTupleOf(Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.static CompletableFuture<Void> mRunAnyAsync(Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> mRunAnyAsync(Executor executor, Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> mRunAnySuccessAsync(Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> mRunAnySuccessAsync(Executor executor, Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> mRunFailFastAsync(Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> mRunFailFastAsync(Executor executor, Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static <T> CompletableFuture<List<T>> mSupplyAllSuccessAsync(Executor executor, T valueIfFailed, Supplier<? extends T>... suppliers) Shortcut to methodallSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<List<T>> mSupplyAllSuccessAsync(T valueIfFailed, Supplier<? extends T>... suppliers) Shortcut to methodallSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyAllSuccessTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyAllSuccessTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyAllSuccessTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyAllSuccessTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyAllSuccessTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyAllSuccessTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyAllSuccessTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyAllSuccessTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.static <T> CompletableFuture<T> mSupplyAnyAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodanyOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<T> mSupplyAnyAsync(Supplier<? extends T>... suppliers) Shortcut to methodanyOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T> CompletableFuture<T> mSupplyAnySuccessAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodanySuccessOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<T> mSupplyAnySuccessAsync(Supplier<? extends T>... suppliers) Shortcut to methodanySuccessOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T> CompletableFuture<List<T>> mSupplyAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodallResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<List<T>> mSupplyAsync(Supplier<? extends T>... suppliers) Shortcut to methodallResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T> CompletableFuture<List<T>> mSupplyFailFastAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodallResultsFailFastOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<List<T>> mSupplyFailFastAsync(Supplier<? extends T>... suppliers) Shortcut to methodallResultsFailFastOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(Executor executor, T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) Shortcut to methodmostSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) Shortcut to methodmostSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAsync(Supplier[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAsync(Supplier[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAsync(Supplier[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAsync(Supplier[]).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyTupleFailFastAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyTupleFailFastAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyTupleFailFastAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyTupleFailFastAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]).static <T1,T2> CompletableFuture <Tuple2<T1, T2>> mSupplyTupleFailFastAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Supplier[]).static <T1,T2, T3>
CompletableFuture<Tuple3<T1, T2, T3>> mSupplyTupleFailFastAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Supplier[]).static <T1,T2, T3, T4>
CompletableFuture<Tuple4<T1, T2, T3, T4>> mSupplyTupleFailFastAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Supplier[]).static <T1,T2, T3, T4, T5>
CompletableFuture<Tuple5<T1, T2, T3, T4, T5>> mSupplyTupleFailFastAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Supplier[]).static <U> CompletableFuture<U> newIncompleteFuture(CompletableFuture<?> cfThis) Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.static <C extends CompletableFuture<?>>
CExceptionally completes given CompletableFuture with aTimeoutExceptionif not otherwise completed before the given timeout.static <T,C extends CompletionStage<? extends T>>
Cpeek(C cfThis, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when the given stage completes, returns the given stage.static <T,C extends CompletionStage<? extends T>>
CpeekAsync(C cfThis, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action using the default executor of parameter cfThis when the given stage completes, returns the given stage.static <T,C extends CompletionStage<? extends T>>
CpeekAsync(C cfThis, BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action using the supplied executor when the given stage completes, returns the given stage.static <T> TReturns the computed result, without waiting.static CompletableFuture<Void> runAfterBothFailFast(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action.static CompletableFuture<Void> runAfterBothFailFastAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the default executor of parameter cfThis.static CompletableFuture<Void> runAfterBothFailFastAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action, Executor executor) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the supplied executor.static CompletableFuture<Void> runAfterEitherSuccess(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action.static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action using the default executor of parameter cfThis.static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action, Executor executor) Returns a new CompletableFuture that, when either given stage success, executes the given action using the supplied executor.static CffuStateReturns the computation state (CffuState).static <T,U> CompletableFuture <Void> thenAcceptBothFailFast(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied action.static <T,U> CompletableFuture <Void> thenAcceptBothFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the default executor of parameter cfThis, with the two results as arguments to the supplied action.static <T,U> CompletableFuture <Void> thenAcceptBothFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action.static <T,U, V> CompletableFuture <V> thenCombineFailFast(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied function.static <T,U, V> CompletableFuture <V> thenCombineFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the default executor of parameter cfThis, with the two results as arguments to the supplied function.static <T,U, V> CompletableFuture <V> thenCombineFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.static <T> CompletableFuture<Void> thenMAcceptAnyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptAnyAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptAnySuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptAnySuccessAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodallOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodallOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodallFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.static <T> CompletableFuture<Void> thenMAcceptFailFastAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodallFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.static <T,U> CompletableFuture <List<U>> thenMApplyAllSuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyAllSuccessAsync(CompletableFuture<? extends T> cfThis, U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.static <T,U> CompletableFuture <U> thenMApplyAnyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <U> thenMApplyAnyAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <U> thenMApplyAnySuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <U> thenMApplyAnySuccessAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyMostSuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U> CompletableFuture <List<U>> thenMApplyMostSuccessAsync(CompletableFuture<? extends T> cfThis, U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]).static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]).static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]).static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]).static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]).static <T,U1, U2>
CompletableFuture<Tuple2<U1, U2>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]).static <T,U1, U2, U3>
CompletableFuture<Tuple3<U1, U2, U3>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]).static <T,U1, U2, U3, U4>
CompletableFuture<Tuple4<U1, U2, U3, U4>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]).static <T,U1, U2, U3, U4, U5>
CompletableFuture<Tuple5<U1, U2, U3, U4, U5>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]).static CompletableFuture<Void> thenMRunAnyAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> thenMRunAnyAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> thenMRunAnySuccessAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> thenMRunAnySuccessAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> thenMRunAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> thenMRunAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static CompletableFuture<Void> thenMRunFailFastAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).static CompletableFuture<Void> thenMRunFailFastAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).static <T> CompletableFuture<T>[]toCompletableFutureArray(CompletionStage<T>... stages) Converts inputCompletionStage(includingCffu/CompletableFuture) array element byCompletionStage.toCompletableFuture().static ThrowableUnwraps CompletableFuture exception (CompletionExceptionorExecutionException) to its cause exception.
-
Method Details
-
mSupplyFailFastAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyFailFastAsync(Supplier<? extends T>... suppliers) Shortcut to methodallResultsFailFastOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
allResultsFailFastOfdocumentation for the rules of result computation. -
mSupplyFailFastAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyFailFastAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodallResultsFailFastOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
allResultsFailFastOfdocumentation for the rules of result computation. -
mSupplyAllSuccessAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyAllSuccessAsync(@Nullable T valueIfFailed, Supplier<? extends T>... suppliers) Shortcut to methodallSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
allSuccessResultsOfdocumentation for the rules of result computation. -
mSupplyAllSuccessAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyAllSuccessAsync(Executor executor, @Nullable T valueIfFailed, Supplier<? extends T>... suppliers) Shortcut to methodallSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
allSuccessResultsOfdocumentation for the rules of result computation. -
mSupplyMostSuccessAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(@Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) Shortcut to methodmostSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
mostSuccessResultsOfdocumentation for the rules of result computation. -
mSupplyMostSuccessAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(Executor executor, @Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) Shortcut to methodmostSuccessResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
mostSuccessResultsOfdocumentation for the rules of result computation. -
mSupplyAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyAsync(Supplier<? extends T>... suppliers) Shortcut to methodallResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
allResultsOfdocumentation for the rules of result computation. -
mSupplyAsync
@SafeVarargs public static <T> CompletableFuture<List<T>> mSupplyAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodallResultsOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
allResultsOfdocumentation for the rules of result computation. -
mSupplyAnySuccessAsync
@SafeVarargs public static <T> CompletableFuture<T> mSupplyAnySuccessAsync(Supplier<? extends T>... suppliers) Shortcut to methodanySuccessOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
anySuccessOfdocumentation for the rules of result computation. -
mSupplyAnySuccessAsync
@SafeVarargs public static <T> CompletableFuture<T> mSupplyAnySuccessAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodanySuccessOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
anySuccessOfdocumentation for the rules of result computation. -
mSupplyAnyAsync
@SafeVarargs public static <T> CompletableFuture<T> mSupplyAnyAsync(Supplier<? extends T>... suppliers) Shortcut to methodanyOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier).See the
anyOfdocumentation for the rules of result computation. -
mSupplyAnyAsync
@SafeVarargs public static <T> CompletableFuture<T> mSupplyAnyAsync(Executor executor, Supplier<? extends T>... suppliers) Shortcut to methodanyOf, wraps input suppliers to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor).See the
anyOfdocumentation for the rules of result computation. -
mRunFailFastAsync
Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
allFailFastOfdocumentation for the rules of result computation. -
mRunFailFastAsync
Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
allFailFastOfdocumentation for the rules of result computation. -
mRunAsync
Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
allOfdocumentation for the rules of result computation. -
mRunAsync
Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
allOfdocumentation for the rules of result computation. -
mRunAnySuccessAsync
Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
anySuccessOfdocumentation for the rules of result computation. -
mRunAnySuccessAsync
Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
anySuccessOfdocumentation for the rules of result computation. -
mRunAnyAsync
Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
anyOfdocumentation for the rules of result computation. -
mRunAnyAsync
Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
anyOfdocumentation for the rules of result computation. -
mSupplyTupleFailFastAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyTupleFailFastAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyTupleFailFastAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyTupleFailFastAsyncT3>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyTupleFailFastAsyncT3>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyTupleFailFastAsyncT3, T4>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyTupleFailFastAsyncT3, T4>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyTupleFailFastAsyncT3, T4, T5>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Supplier[]). -
mSupplyTupleFailFastAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyTupleFailFastAsyncT3, T4, T5>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyAllSuccessTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyAllSuccessTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyAllSuccessTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyAllSuccessTupleAsyncT3>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyAllSuccessTupleAsyncT3>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyAllSuccessTupleAsyncT3, T4>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyAllSuccessTupleAsyncT3, T4>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyAllSuccessTupleAsyncT3, T4, T5>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAllSuccessAsync(Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyAllSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyAllSuccessTupleAsyncT3, T4, T5>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAllSuccessAsync(Executor, Object, Supplier[])withnullvalueIfFailed.If any of the provided suppliers fails, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyMostSuccessTupleAsyncT3>> (long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyMostSuccessTupleAsyncT3>> (Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyMostSuccessTupleAsyncT3, T4>> (long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyMostSuccessTupleAsyncT3, T4>> (Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyMostSuccessTupleAsyncT3, T4, T5>> (long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyMostSuccessAsync(Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyMostSuccessTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyMostSuccessTupleAsyncT3, T4, T5>> (Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyMostSuccessAsync(Executor, Object, long, TimeUnit, Supplier[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mSupplyTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyTupleAsync(Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyAsync(Supplier[]). -
mSupplyTupleAsync
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mSupplyTupleAsync(Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyTupleAsyncT3>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyAsync(Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mSupplyTupleAsyncT3>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyTupleAsyncT3, T4>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyAsync(Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mSupplyTupleAsyncT3, T4>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyTupleAsyncT3, T4, T5>> (Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyAsync(Supplier[]). -
mSupplyTupleAsync
public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mSupplyTupleAsyncT3, T4, T5>> (Executor executor, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) Tuple variant ofmSupplyFailFastAsync(Executor, Supplier[]). -
allResultsFailFastOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> allResultsFailFastOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a CompletableFuture completed with the value empty list.The list of results is in the same order as the input list.
This method is the same as
allResultsOfmethod except for the fail-fast behavior.- Throws:
NullPointerException- if the cfs param or any of its elements arenull- See Also:
-
allSuccessResultsOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> allSuccessResultsOf(@Nullable T valueIfFailed, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete; The list of results is in the same order as the input list, and if any of given stages complete exceptionally, their corresponding position will containvalueIfFailed(which is indistinguishable from the stage having a successful value ofvalueIfFailed). If no stages are provided, returns a CompletableFuture completed with the value empty list.The list of results is in the same order as the input list.
This method differs from
allResultsFailFastOfmethod in that it's tolerant of failed stages for any of the items, representing them asvalueIfFailedin the result list.- Parameters:
valueIfFailed- the value used as result if the input stage completed exceptionally- Throws:
NullPointerException- if the cfs param or any of its elements isnull- See Also:
-
mostSuccessResultsOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> mostSuccessResultsOf(@Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of the given stages before the given timeout (aka as many results as possible in the given time); The list of results is in the same order as the input list, and if any of given stages complete exceptionally or are incomplete, their corresponding positions will containvalueIfNotSuccess(which is indistinguishable from the stage having a successful value ofvalueIfNotSuccess). If no stages are provided, returns a CompletableFuture completed with the value empty list.The list of results is in the same order as the input list.
This method differs from
allResultsFailFastOfmethod in that it's tolerant of failed or incomplete stages for any of the items, representing them asvalueIfNotSuccessin the result list.- Parameters:
valueIfNotSuccess- the value used as result if the input stage not completed normallytimeout- how long to wait in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Throws:
NullPointerException- if the cfs param or any of its elements arenull- See Also:
-
mostSuccessResultsOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> mostSuccessResultsOf(Executor executorWhenTimeout, @Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of the given stages before the given timeout (aka as many results as possible in the given time); The list of results is in the same order as the input list, and if any of given stages complete exceptionally or are incomplete, their corresponding positions will containvalueIfNotSuccess(which is indistinguishable from the stage having a successful value ofvalueIfNotSuccess). If no stages are provided, returns a CompletableFuture completed with the value empty list.The list of results is in the same order as the input list.
This method differs from
allResultsFailFastOfmethod in that it's tolerant of failed or incomplete stages for any of the items, representing them asvalueIfNotSuccessin the result list.- Parameters:
executorWhenTimeout- the executor to use for asynchronous execution when timeoutvalueIfNotSuccess- the value used as result if the input stage not completed normallytimeout- how long to wait in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Throws:
NullPointerException- if the cfs param or any of its elements arenull- See Also:
-
allResultsOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<List<T>> allResultsOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed normally with a list containing the successful results of all given stages when all the given stages complete; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns a CompletableFuture completed with the value empty list.The list of results is in the same order as the input list.
Comparing the waiting-all-complete behavior of this method, the fail-fast behavior of
allResultsFailFastOfmethod is more responsive to user and generally more desired in the application.This method is the same as
allOfmethod, except that the returned CompletableFuture contains the results of the given stages.- Throws:
NullPointerException- if the cfs param or any of its elements arenull
-
allFailFastOf
Returns a new CompletableFuture that is completed normally when all the given stages complete normally; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, WITHOUT waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a CompletableFuture completed with the valuenull.The successful results, if any, of the given stages are not reflected in the returned CompletableFuture (
CompletableFuture<Void>), but may be obtained by inspecting them individually; Or using below methods reflected results in the returned CompletableFuture which are more convenient, safer and best-practice of concurrency:allResultsFailFastOf,allTupleFailFastOfallSuccessResultsOf,allSuccessTupleOfmostSuccessResultsOf,mostSuccessTupleOfallResultsOf,allTupleOf
This method is the same as
allOfmethod except for the fail-fast behavior.- Throws:
NullPointerException- if the cfs param or any of its elements arenull- See Also:
-
allOf
@CheckReturnValue(explanation="should use the returned CompletableFuture; forget to call its `join()` method?") @Contract(pure=true) public static CompletableFuture<Void> allOf(CompletionStage<?>... cfs) Returns a new CompletableFuture that is completed when all the given stages complete; If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns a CompletableFuture completed with the valuenull.The successful results, if any, of the given stages are not reflected in the returned CompletableFuture (
CompletableFuture<Void>), but may be obtained by inspecting them individually; Or using below methods reflected results in the returned CompletableFuture which are more convenient, safer and best-practice of concurrency:allResultsOf,allTupleOfallResultsFailFastOf,allTupleFailFastOfallSuccessResultsOf,allSuccessTupleOfmostSuccessResultsOf,mostSuccessTupleOf
Among the applications of this method is to await completion of a set of independent stages before continuing a program, as in:
CompletableFuture.allOf(c1, c2, c3).join();.This method is the same as
CompletableFuture#allOfmethod, except that the parameter type is more genericCompletionStageinstead ofCompletableFuture.- Throws:
NullPointerException- if the cfs param or any of its elements arenull- See Also:
-
anySuccessOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T> anySuccessOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that completed normally when any of the given stages complete normally, with the same result; Otherwise, when all the given stages complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given stages as its cause. If no stages are provided, returns a new CompletableFuture that is already completed exceptionally with aNoCfsProvidedException.This method differs from
anyOfmethod in that this method is any-success instead of the any-complete behavior of methodanyOf.- Throws:
NullPointerException- if the cfs param or any of its elements arenull
-
anyOf
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T> anyOf(CompletionStage<? extends T>... cfs) Returns a new CompletableFuture that is completed with the same successful result or exception of any of the given stages when one stage completes. If no stages are provided, returns an incomplete CompletableFuture.Comparing the any-complete behavior(the complete one may be failed) of this method, the any-success behavior of method
anySuccessOfis generally more desired in the application.This method is the same as
CompletableFuture#anyOfmethod, except that the parameter type is more genericCompletionStageinstead ofCompletableFutureand the return type is more specificTinstead ofObject.- Throws:
NullPointerException- if the cfs param or any of its elements arenull
-
allTupleFailFastOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> allTupleFailFastOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallResultsFailFastOf(CompletionStage[]). -
allTupleFailFastOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, allTupleFailFastOfT3>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallResultsFailFastOf(CompletionStage[]). -
allTupleFailFastOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, allTupleFailFastOfT3, T4>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallResultsFailFastOf(CompletionStage[]). -
allTupleFailFastOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, allTupleFailFastOfT3, T4, T5>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallResultsFailFastOf(CompletionStage[]). -
allSuccessTupleOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> allSuccessTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.If any of the provided stages fails, its corresponding position will contain
null(which is indistinguishable from the stage having a successful value ofnull). -
allSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, allSuccessTupleOfT3>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.If any of the provided stages fails, its corresponding position will contain
null(which is indistinguishable from the stage having a successful value ofnull). -
allSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, allSuccessTupleOfT3, T4>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.If any of the provided stages fails, its corresponding position will contain
null(which is indistinguishable from the stage having a successful value ofnull). -
allSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, allSuccessTupleOfT3, T4, T5>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallSuccessResultsOf(Object, CompletionStage[])withnullvalueIfFailed.If any of the provided stages fails, its corresponding position will contain
null(which is indistinguishable from the stage having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mostSuccessTupleOf(long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> mostSuccessTupleOf(Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mostSuccessTupleOfT3>> (long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, mostSuccessTupleOfT3>> (Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mostSuccessTupleOfT3, T4>> (long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, mostSuccessTupleOfT3, T4>> (Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mostSuccessTupleOfT3, T4, T5>> (long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofmostSuccessResultsOf(Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
mostSuccessTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, mostSuccessTupleOfT3, T4, T5>> (Executor executorWhenTimeout, long timeout, TimeUnit unit, CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofmostSuccessResultsOf(Executor, Object, long, TimeUnit, CompletionStage[])withnullvalueIfNotSuccess.If any of the provided stages is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
allTupleOf
@Contract(pure=true) public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> allTupleOf(CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2) Tuple variant ofallResultsOf(CompletionStage[]). -
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple3<T1,T3> T2, allTupleOfT3>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3) Tuple variant ofallResultsOf(CompletionStage[]). -
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple4<T1,T3, T4> T2, allTupleOfT3, T4>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4) Tuple variant ofallResultsOf(CompletionStage[]). -
allTupleOf
@Contract(pure=true) public static <T1,T2, CompletableFuture<Tuple5<T1,T3, T4, T5> T2, allTupleOfT3, T4, T5>> (CompletionStage<? extends T1> cf1, CompletionStage<? extends T2> cf2, CompletionStage<? extends T3> cf3, CompletionStage<? extends T4> cf4, CompletionStage<? extends T5> cf5) Tuple variant ofallResultsOf(CompletionStage[]). -
failedFuture
Returns a new CompletableFuture that is already completed exceptionally with the given exception.- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed CompletableFuture
-
completedStage
Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* CompletableFuture instance which is NOT a *minimal* CompletionStage.
- Type Parameters:
T- the type of the value- Parameters:
value- the value- Returns:
- the completed CompletionStage
-
failedStage
Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* CompletableFuture instance which is NOT a *minimal* CompletionStage.
- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed CompletionStage
-
delayedExecutor
Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameter- Returns:
- the new delayed executor
-
delayedExecutor
@Contract(pure=true) public static Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameterexecutor- the base executor- Returns:
- the new delayed executor
-
thenMApplyFailFastAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.See the
allResultsFailFastOfdocumentation for the rules of result computation. -
thenMApplyFailFastAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
allResultsFailFastOfdocumentation for the rules of result computation.NOTE: if the
executorargument is passed by lambda, theRunnablelambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAllSuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyAllSuccessAsync(CompletableFuture<? extends T> cfThis, @Nullable U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.See the
allSuccessResultsOfdocumentation for the rules of result computation. -
thenMApplyAllSuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyAllSuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, @Nullable U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
allSuccessResultsOfdocumentation for the rules of result computation.NOTE: if the
executorargument is passed by lambda, theRunnablelambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyMostSuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyMostSuccessAsync(CompletableFuture<? extends T> cfThis, @Nullable U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
mostSuccessResultsOfdocumentation for the rules of result computation. -
thenMApplyMostSuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyMostSuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, @Nullable U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
mostSuccessResultsOfdocumentation for the rules of result computation. -
thenMApplyAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.See the
allResultsOfdocumentation for the rules of result computation. -
thenMApplyAsync
@SafeVarargs public static <T,U> CompletableFuture<List<U>> thenMApplyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
allResultsOfdocumentation for the rules of result computation.NOTE: if the
executorargument is passed by lambda, theRunnablelambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAnySuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<U> thenMApplyAnySuccessAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.See the
anySuccessOfdocumentation for the rules of result computation. -
thenMApplyAnySuccessAsync
@SafeVarargs public static <T,U> CompletableFuture<U> thenMApplyAnySuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
anySuccessOfdocumentation for the rules of result computation.NOTE: if the
executorargument is passed by lambda, theRunnablelambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAnyAsync
@SafeVarargs public static <T,U> CompletableFuture<U> thenMApplyAnyAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of functions.See the
anyOfdocumentation for the rules of result computation. -
thenMApplyAnyAsync
@SafeVarargs public static <T,U> CompletableFuture<U> thenMApplyAnyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of functions.See the
anyOfdocumentation for the rules of result computation.NOTE: if the
executorargument is passed by lambda, theRunnablelambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMAcceptFailFastAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptFailFastAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodallFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.See the
allFailFastOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptFailFastAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodallFailFastOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.See the
allFailFastOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodallOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.See the
allOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodallOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.See the
allOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnySuccessAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAnySuccessAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.See the
anySuccessOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnySuccessAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAnySuccessAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodanySuccessOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.See the
anySuccessOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnyAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAnyAsync(CompletableFuture<? extends T> cfThis, Consumer<? super T>... actions) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier); The given stage's result is used as the argument of actions.See the
anyOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnyAsync
@SafeVarargs public static <T> CompletableFuture<Void> thenMAcceptAnyAsync(CompletableFuture<? extends T> cfThis, Executor executor, Consumer<? super T>... actions) Shortcut to methodanyOf, wraps input functions to CompletableFuture byCompletableFuture.supplyAsync(Supplier, Executor); The given stage's result is used as the argument of actions.See the
anyOfdocumentation for the rules of result computation.NOTE: if the second argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMRunFailFastAsync
public static CompletableFuture<Void> thenMRunFailFastAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
allFailFastOfdocumentation for the rules of result computation. -
thenMRunFailFastAsync
public static CompletableFuture<Void> thenMRunFailFastAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodallFailFastOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
allFailFastOfdocumentation for the rules of result computation. -
thenMRunAsync
public static CompletableFuture<Void> thenMRunAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
allOfdocumentation for the rules of result computation. -
thenMRunAsync
public static CompletableFuture<Void> thenMRunAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodallOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
allOfdocumentation for the rules of result computation. -
thenMRunAnySuccessAsync
public static CompletableFuture<Void> thenMRunAnySuccessAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
anySuccessOfdocumentation for the rules of result computation. -
thenMRunAnySuccessAsync
public static CompletableFuture<Void> thenMRunAnySuccessAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodanySuccessOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
anySuccessOfdocumentation for the rules of result computation. -
thenMRunAnyAsync
public static CompletableFuture<Void> thenMRunAnyAsync(CompletableFuture<?> cfThis, Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable).See the
anyOfdocumentation for the rules of result computation. -
thenMRunAnyAsync
public static CompletableFuture<Void> thenMRunAnyAsync(CompletableFuture<?> cfThis, Executor executor, Runnable... actions) Shortcut to methodanyOf, wraps input actions to CompletableFuture byCompletableFuture.runAsync(Runnable, Executor).See the
anyOfdocumentation for the rules of result computation. -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyTupleFailFastAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyTupleFailFastAsyncU3>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyTupleFailFastAsyncU3>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyTupleFailFastAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyTupleFailFastAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyTupleFailFastAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Function[]). -
thenMApplyTupleFailFastAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyTupleFailFastAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyFailFastAsync(CompletableFuture, Executor, Function[]). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyAllSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyAllSuccessTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyAllSuccessTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyAllSuccessTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyAllSuccessTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyAllSuccessTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyAllSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyAllSuccessTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAllSuccessAsync(CompletableFuture, Executor, Object, Function[])withnullvalueIfFailed.If any of the provided functions fails, its corresponding position will contain
null(which is indistinguishable from the function having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyMostSuccessTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyMostSuccessTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyMostSuccessTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyMostSuccessTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyMostSuccessTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyMostSuccessTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyMostSuccessTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyMostSuccessTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyMostSuccessAsync(CompletableFuture, Executor, Object, long, TimeUnit, Function[])withnullvalueIfNotSuccess.If any of the provided suppliers is not completed normally, its corresponding position will contain
null(which is indistinguishable from the supplier having a successful value ofnull). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple2<U1,U2> U2>> thenMApplyTupleAsync(CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple3<U1,U2, U3> U2, thenMApplyTupleAsyncU3>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple4<U1,U2, U3, U4> U2, thenMApplyTupleAsyncU3, U4>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAsync(CompletableFuture, Function[]). -
thenMApplyTupleAsync
public static <T,U1, CompletableFuture<Tuple5<U1,U2, U3, U4, U5> U2, thenMApplyTupleAsyncU3, U4, U5>> (CompletableFuture<? extends T> cfThis, Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3, Function<? super T, ? extends U4> fn4, Function<? super T, ? extends U5> fn5) Tuple variant ofthenMApplyAsync(CompletableFuture, Executor, Function[]). -
thenCombineFailFast
public static <T,U, CompletableFuture<V> thenCombineFailFastV> (CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture
-
thenCombineFailFastAsync
public static <T,U, CompletableFuture<V> thenCombineFailFastAsyncV> (CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the default executor of parameter cfThis, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture
-
thenCombineFailFastAsync
public static <T,U, CompletableFuture<V> thenCombineFailFastAsyncV> (CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture
-
thenAcceptBothFailFast
public static <T,U> CompletableFuture<Void> thenAcceptBothFailFast(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
thenAcceptBothFailFastAsync
public static <T,U> CompletableFuture<Void> thenAcceptBothFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the default executor of parameter cfThis, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
thenAcceptBothFailFastAsync
public static <T,U> CompletableFuture<Void> thenAcceptBothFailFastAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
runAfterBothFailFast
public static CompletableFuture<Void> runAfterBothFailFast(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
runAfterBothFailFastAsync
public static CompletableFuture<Void> runAfterBothFailFastAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the default executor of parameter cfThis. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
runAfterBothFailFastAsync
public static CompletableFuture<Void> runAfterBothFailFastAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action, Executor executor) Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the supplied executor. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
applyToEitherSuccess
public static <T,U> CompletableFuture<U> applyToEitherSuccess(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied function.- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture
-
applyToEitherSuccessAsync
public static <T,U> CompletableFuture<U> applyToEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn) Returns a new CompletableFuture that, when either given stage success, is executed using the default executor of parameter cfThis, with the corresponding result as argument to the supplied function.- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture
-
applyToEitherSuccessAsync
public static <T,U> CompletableFuture<U> applyToEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Function<? super T, ? extends U> fn, Executor executor) Returns a new CompletableFuture that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied function.- Type Parameters:
U- the function's return type- Parameters:
fn- the function to use to compute the value of the returned CompletableFutureexecutor- the executor to use for asynchronous execution
-
acceptEitherSuccess
public static <T> CompletableFuture<Void> acceptEitherSuccess(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied action.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
acceptEitherSuccessAsync
public static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new CompletableFuture that, when either given stage success, is executed using the default executor of parameter cfThis, with the corresponding result as argument to the supplied action.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
acceptEitherSuccessAsync
public static <T> CompletableFuture<Void> acceptEitherSuccessAsync(CompletableFuture<? extends T> cfThis, CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new CompletableFuture that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied action.- Parameters:
action- the action to perform before completing the returned CompletableFutureexecutor- the executor to use for asynchronous execution
-
runAfterEitherSuccess
public static CompletableFuture<Void> runAfterEitherSuccess(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
runAfterEitherSuccessAsync
public static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action) Returns a new CompletableFuture that, when either given stage success, executes the given action using the default executor of parameter cfThis. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
runAfterEitherSuccessAsync
public static CompletableFuture<Void> runAfterEitherSuccessAsync(CompletableFuture<?> cfThis, CompletionStage<?> other, Runnable action, Executor executor) Returns a new CompletableFuture that, when either given stage success, executes the given action using the supplied executor. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.- Parameters:
action- the action to perform before completing the returned CompletableFuture
-
catching
public static <T,X extends Throwable, C catchingC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function. Otherwise, the returned stage contains same result as the given stage."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.fallback- the Function to be called if cfThis fails with the expected exception type. The function's argument is the exception from cfThis.- See Also:
-
catchingAsync
public static <T,X extends Throwable, C catchingAsyncC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function, using the default executor of parameter the given stage. Otherwise, the returned stage contains same result as the given stage."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.fallback- the Function to be called if cfThis fails with the expected exception type. The function's argument is the exception from cfThis.- See Also:
-
catchingAsync
public static <T,X extends Throwable, C catchingAsyncC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends T> fallback, Executor executor) Returns a new CompletableFuture that, when given stage completes exceptionally with the given exceptionType, is executed with the exception from the given stage(argument cfThis) as the argument to the supplied function, using the supplied Executor. Otherwise, the returned stage contains same result as the given stage."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.executor- the executor to use for asynchronous execution- See Also:
-
exceptionallyAsync
public static <T,C extends CompletionStage<? super T>> C exceptionallyAsync(C cfThis, Function<Throwable, ? extends T> fn) Returns a new CompletableFuture that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the default executor of parameter cfThis. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.Just as catching
Throwableis not best practice in general, this method handles theThrowable; Strongly recommend usingcatchingAsync(CompletionStage, Class, Function)instead in your business application.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture if given CompletionStage completed exceptionally- See Also:
-
exceptionallyAsync
public static <T,C extends CompletionStage<? super T>> C exceptionallyAsync(C cfThis, Function<Throwable, ? extends T> fn, Executor executor) Returns a new CompletableFuture that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.Just as catching
Throwableis not best practice in general, this method handles theThrowable; Strongly recommend usingcatchingAsync(CompletionStage, Class, Function, Executor)instead in your business application.- Parameters:
fn- the function to use to compute the value of the returned CompletableFuture if given CompletionStage completed exceptionallyexecutor- the executor to use for asynchronous execution- See Also:
-
cffuOrTimeout
public static <C extends CompletableFuture<?>> C cffuOrTimeout(C cfThis, long timeout, TimeUnit unit) Returns a new CompletableFuture that is completed exceptionally with aTimeoutExceptionwhen the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.Uses the default executor of parameter cfThis as
executorWhenTimeout.CAUTION: This method returns a new CompletableFuture instead of
cfThisto avoid the subsequent usage of the delay thread; This behavior is DIFFERENT from the original CF methodCompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)and its backport methodorTimeout(C, long, java.util.concurrent.TimeUnit). More info see the javadoc oforTimeout(C, long, java.util.concurrent.TimeUnit)and the demo DelayDysfunctionDemo.- Parameters:
timeout- how long to wait before completing exceptionally with a TimeoutException, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- See Also:
-
cffuOrTimeout
public static <C extends CompletableFuture<?>> C cffuOrTimeout(C cfThis, long timeout, TimeUnit unit, Executor executorWhenTimeout) Returns a new CompletableFuture that is completed exceptionally with aTimeoutExceptionwhen the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.CAUTION: This method returns a new CompletableFuture instead of
cfThisto avoid the subsequent usage of the delay thread; This behavior is DIFFERENT from the original CF methodCompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)and its backport methodorTimeout(C, long, java.util.concurrent.TimeUnit). More info see the javadoc oforTimeout(C, long, java.util.concurrent.TimeUnit)and the demo DelayDysfunctionDemo.- Parameters:
timeout- how long to wait before completing exceptionally with a TimeoutException, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameterexecutorWhenTimeout- the executor to use for asynchronous execution when the wait timed out
-
orTimeout
@Contract("_, _, _ -> param1") public static <C extends CompletableFuture<?>> C orTimeout(C cfThis, long timeout, TimeUnit unit) Exceptionally completes given CompletableFuture with aTimeoutExceptionif not otherwise completed before the given timeout.CAUTION:
CompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)and this backport method are UNSAFE!When the wait timed out, the subsequent non-async actions of the dependent CompletableFutures are performed in CompletableFuture's internal SINGLE-thread delay executor (including timeout functionality). This means that the long-running subsequent non-async actions will block this executor thread, preventing it from handling other timeouts and delays, effectively breaking CompletableFuture's timeout and delay functionality.
Strongly recommend using the safe method
cffuOrTimeout(CompletableFuture, long, TimeUnit, Executor)instead ofCompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)and this backport method.
The only case where usingCompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)and this backport method makes sense is when all subsequent actions of dependent CompletableFutures are guaranteed to execute asynchronously (i.e. the dependent CompletableFutures are created by async methods). In this case, they save one thread switch when the timeout triggers.Note: Before Java 21(Java 20-),
CompletableFuture.orTimeout(long, java.util.concurrent.TimeUnit)leaks if the future completes exceptionally, more info see issue JDK-8303742, PR review openjdk/jdk/13059 and JDK bugfix commit. The cffu backport logic(for Java 20-) has merged this JDK bugfix.- Parameters:
timeout- how long to wait before completing exceptionally with a TimeoutException, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Returns:
- the given CompletableFuture
- See Also:
-
cffuCompleteOnTimeout
public static <T,C extends CompletableFuture<? super T>> C cffuCompleteOnTimeout(C cfThis, @Nullable T value, long timeout, TimeUnit unit) Returns a new CompletableFuture that is completed normally with the given value when the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.Uses the default executor of parameter cfThis as
executorWhenTimeout.CAUTION: This method returns a new CompletableFuture instead of
cfThisto avoid the subsequent usage of the delay thread. This behavior is DIFFERENT from the original CF methodCompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)and its backport methodcompleteOnTimeout(C, T, long, java.util.concurrent.TimeUnit). More info see the javadoc ofcompleteOnTimeout(C, T, long, java.util.concurrent.TimeUnit)and the demo DelayDysfunctionDemo.- Parameters:
value- the value to use upon timeouttimeout- how long to wait before completing normally with the given value, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- See Also:
-
cffuCompleteOnTimeout
public static <T,C extends CompletableFuture<? super T>> C cffuCompleteOnTimeout(C cfThis, @Nullable T value, long timeout, TimeUnit unit, Executor executorWhenTimeout) Returns a new CompletableFuture that is completed normally with the given value when the given CompletableFuture is not completed before the given timeout; otherwise the returned CompletableFuture completed with the same successful result or exception of the given CompletableFuture.CAUTION: This method returns a new CompletableFuture instead of
cfThisto avoid the subsequent usage of the delay thread. This behavior is DIFFERENT from the original CF methodCompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)and its backport methodcompleteOnTimeout(C, T, long, java.util.concurrent.TimeUnit). More info see the javadoc ofcompleteOnTimeout(C, T, long, java.util.concurrent.TimeUnit)and the demo DelayDysfunctionDemo.- Parameters:
value- the value to use upon timeouttimeout- how long to wait before completing normally with the given value, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameterexecutorWhenTimeout- the executor to use for asynchronous execution when the wait timed out
-
completeOnTimeout
@Contract("_, _, _, _ -> param1") public static <T,C extends CompletableFuture<? super T>> C completeOnTimeout(C cfThis, @Nullable T value, long timeout, TimeUnit unit) Completes given CompletableFuture with the given value if not otherwise completed before the given timeout.CAUTION:
CompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)and this backport method are UNSAFE!When the wait timed out, the subsequent non-async actions of the dependent CompletableFutures are performed in CompletableFuture's internal SINGLE-thread delay executor (including timeout functionality). This means that the long-running subsequent non-async actions will block this executor thread, preventing it from handling other timeouts and delays, effectively breaking CompletableFuture's timeout and delay functionality.
Strongly recommend using the safe method
cffuCompleteOnTimeout(CompletableFuture, Object, long, TimeUnit, Executor)instead ofCompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)and this backport method.
The only case where usingCompletableFuture.completeOnTimeout(T, long, java.util.concurrent.TimeUnit)and this backport method makes sense is when all subsequent actions of dependent CompletableFutures are guaranteed to execute asynchronously (i.e. the dependent CompletableFutures are created by async methods). In this case, they save one thread switch when the timeout triggers.- Parameters:
value- the value to use upon timeouttimeout- how long to wait before completing normally with the given value, in units ofunitunit- aTimeUnitdetermining how to interpret thetimeoutparameter- Returns:
- the given CompletableFuture
- See Also:
-
catchingCompose
public static <T,X extends Throwable, C catchingComposeC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis)."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.fallback- the Function to be called if cfThis fails with the expected exception type. The function's argument is the exception from cfThis.- See Also:
-
catchingComposeAsync
public static <T,X extends Throwable, C catchingComposeAsyncC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis), using the default executor of parameter the given stage."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.fallback- the Function to be called if cfThis fails with the expected exception type. The function's argument is the exception from cfThis.- See Also:
-
catchingComposeAsync
public static <T,X extends Throwable, C catchingComposeAsyncC extends CompletionStage<? super T>> (C cfThis, Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback, Executor executor) Returns a new CompletionStage that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from the given stage(argument cfThis), using the supplied Executor."The exception from the given stage(
argument cfThis)" means the cause of theExecutionExceptionthrown byget()or, ifget()throws a different kind of exception, that exception itself; aka the exception is unwrapped byunwrapCfException(Throwable).- Parameters:
exceptionType- the exception type that triggers use offallback. The exception type is matched against the exception from argument cfThis. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.classin particular.fallback- the Function to be called if cfThis fails with the expected exception type. The function's argument is the exception from cfThis.executor- the executor to use for asynchronous execution- See Also:
-
exceptionallyCompose
public static <T,C extends CompletionStage<? super T>> C exceptionallyCompose(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception.Just as catching
Throwableis not best practice in general, this method handles theThrowable; Strongly recommend usingcatchingCompose(CompletionStage, Class, Function)instead in your business application.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionally- See Also:
-
exceptionallyComposeAsync
public static <T,C extends CompletionStage<? super T>> C exceptionallyComposeAsync(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the default executor of parameter cfThis.Just as catching
Throwableis not best practice in general, this method handles theThrowable; Strongly recommend usingcatchingComposeAsync(CompletionStage, Class, Function)instead in your business application.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionally- See Also:
-
exceptionallyComposeAsync
public static <T,C extends CompletionStage<? super T>> C exceptionallyComposeAsync(C cfThis, Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new CompletableFuture that, when given CompletableFuture completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the supplied Executor.Just as catching
Throwableis not best practice in general, this method handles theThrowable; Strongly recommend usingcatchingComposeAsync(CompletionStage, Class, Function, Executor)instead in your business application.- Parameters:
fn- the function to use to compute the returned CompletableFuture if given CompletionStage completed exceptionallyexecutor- the executor to use for asynchronous execution- See Also:
-
peek
@Contract("_, _ -> param1") public static <T,C extends CompletionStage<? extends T>> C peek(C cfThis, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when the given stage completes, returns the given stage.When the given stage is complete, the given action is invoked with the result(or
nullif none) and the exception (ornullif none) of given stage as arguments.CAUTION: The return stage of method
CompletionStage.whenComplete(BiConsumer)will contain DIFFERENT result to the input stage when the input stage is completed normally but the supplied action throws an exception. This behavior of methodwhenCompleteis subtle, and common misused if you just want to peek the input stage without affecting the result(e.g. logging the cf result).
For thispeekmethod, whether the supplied action throws an exception or not, the result of return stage(aka. the given stage) is NOT affected.Unlike method
CompletionStage.handle(BiFunction)and like methodCompletionStage.whenComplete(BiConsumer), this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
peekAsync
@Contract("_, _ -> param1") public static <T,C extends CompletionStage<? extends T>> C peekAsync(C cfThis, BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action using the default executor of parameter cfThis when the given stage completes, returns the given stage.When the given stage is complete, the given action is invoked with the result(or
nullif none) and the exception (ornullif none) of given stage as arguments.CAUTION: The return stage of method
CompletionStage.whenCompleteAsync(BiConsumer)will contain DIFFERENT result to the input stage when the input stage is completed normally but the supplied action throws an exception. This behavior of methodwhenCompleteis subtle, and common misused if you just want to peek the input stage without affecting the result(e.g. logging the cf result).
For thispeekmethod, whether the supplied action throws an exception or not, the result of return stage(aka. the given stage) is NOT affected.Unlike method
CompletionStage.handleAsync(BiFunction)and like methodCompletionStage.whenCompleteAsync(BiConsumer), this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
peekAsync
@Contract("_, _, _ -> param1") public static <T,C extends CompletionStage<? extends T>> C peekAsync(C cfThis, BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action using the supplied executor when the given stage completes, returns the given stage.When the given stage is complete, the given action is invoked with the result(or
nullif none) and the exception (ornullif none) of given stage as arguments.CAUTION: The return stage of method
CompletionStage.whenCompleteAsync(BiConsumer, Executor)will contain DIFFERENT result to the input stage when the input stage is completed normally but the supplied action throws an exception. This behavior of methodwhenCompleteis subtle, and common misused if you just want to peek the input stage without affecting the result(e.g. logging the cf result).
For thispeekmethod, whether the supplied action throws an exception or not, the result of return stage(aka. the given stage) is NOT affected.Unlike method
CompletionStage.handleAsync(BiFunction, Executor)and like methodCompletionStage.whenCompleteAsync(BiConsumer, Executor), this method is not designed to translate completion outcomes.- Parameters:
action- the action to perform- Returns:
- the given stage
- See Also:
-
join
@Blocking @Nullable public static <T> T join(CompletableFuture<? extends T> cfThis, long timeout, TimeUnit unit) Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.NOTE: Calling this method
result = CompletableFutureUtils.join(cf, timeout, unit);is the same as:
CAUTION: if the wait timed out, this method throws an (unchecked)result = cf.copy() // defensive copy to avoid writing this cf unexpectedly .orTimeout(timeout, unit) .join();CompletionExceptionwith theTimeoutExceptionas its cause; NOT throws a (checked)TimeoutExceptionlikeCompletableFuture.get(long, TimeUnit).- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- the result value
- Throws:
CancellationException- if the computation was cancelledCompletionException- if given future completed exceptionally or a completion computation threw an exception or the wait timed out(with theTimeoutExceptionas its cause)- See Also:
-
getSuccessNow
@Contract(pure=true) @Nullable public static <T> T getSuccessNow(CompletableFuture<? extends T> cfThis, @Nullable T valueIfNotSuccess) Returns the result value if the given stage is completed normally, else returns the given valueIfNotSuccess.This method will not throw exceptions (CancellationException/CompletionException/ExecutionException/IllegalStateException/...).
- Parameters:
valueIfNotSuccess- the value to return if not completed normally- Returns:
- the result value, if completed normally, else the given valueIfNotSuccess
-
resultNow
Returns the computed result, without waiting.This method is for cases where the caller knows that the task has already completed normally, for example when filtering a stream of Future objects for the successful tasks and using a mapping operation to obtain a stream of results.
results = futures.stream() .filter(f -> f.state() == Future.State.SUCCESS) .map(Future::resultNow) .toList();- Returns:
- the computed result
- Throws:
IllegalStateException- if the task has not completed or the task did not complete with a result
-
exceptionNow
Returns the exception thrown by the task, without waiting.This method is for cases where the caller knows that the task has already completed with an exception.
- Returns:
- the exception thrown by the task
- Throws:
IllegalStateException- if the task has not completed, the task completed normally, or the task was cancelled
-
state
Returns the computation state (CffuState). This method provides equivalent functionality toCompletableFuture.state()with backwards compatibility forJava 18-.- Returns:
- the computation state
- See Also:
-
completeAsync
@Contract("_, _ -> param1") public static <T,C extends CompletableFuture<? super T>> C completeAsync(C cfThis, Supplier<? extends T> supplier) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor of parameter cfThis.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFuture- Returns:
- the given CompletableFuture
- See Also:
-
completeAsync
@Contract("_, _, _ -> param1") public static <T,C extends CompletableFuture<? super T>> C completeAsync(C cfThis, Supplier<? extends T> supplier, Executor executor) Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFutureexecutor- the executor to use for asynchronous execution- Returns:
- the given CompletableFuture
- See Also:
-
completeExceptionallyAsync
@Contract("_, _ -> param1") public static <C extends CompletableFuture<?>> C completeExceptionallyAsync(C cfThis, Supplier<? extends Throwable> supplier) If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the default executor of parameter cfThis.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFuture- Returns:
- the given CompletableFuture
- See Also:
-
completeExceptionallyAsync
@Contract("_, _, _ -> param1") public static <C extends CompletableFuture<?>> C completeExceptionallyAsync(C cfThis, Supplier<? extends Throwable> supplier, Executor executor) If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the given executor.- Parameters:
supplier- a function returning the value to be used to complete given CompletableFutureexecutor- the executor to use for asynchronous execution- Returns:
- the given CompletableFuture
- See Also:
-
minimalCompletionStage
@Contract(pure=true) public static <T> CompletionStage<T> minimalCompletionStage(CompletableFuture<T> cfThis) Returns a new CompletionStage that is completed normally with the same value as given CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage. If given CompletableFuture completes exceptionally, then the returned CompletionStage completes exceptionally with a CompletionException with given exception as cause.CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* CompletableFuture instance which is NOT a *minimal* CompletionStage.
- See Also:
-
copy
Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally. If this CompletableFuture completes exceptionally, then the returned CompletableFuture completes exceptionally with a CompletionException with this exception as cause. The behavior is equivalent tothenApply(x -> x). This method may be useful as a form of "defensive copying", to prevent clients from completing, while still being able to arrange dependent actions.- See Also:
-
defaultExecutor
Returns the default Executor of parameter cfThis used for async methods that do not specify an Executor.The default executor of CompletableFuture(NOT including the customized subclasses of CompletableFuture) uses the
ForkJoinPool.commonPool()if it supports more than one parallel thread, or else an Executor using one thread per async task. CAUTION: This executor may be not suitable for common business use(io intensive).- See Also:
-
newIncompleteFuture
@Contract(pure=true) public static <U> CompletableFuture<U> newIncompleteFuture(CompletableFuture<?> cfThis) Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.- Type Parameters:
U- the type of the value- See Also:
-
toCompletableFutureArray
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T>[] toCompletableFutureArray(CompletionStage<T>... stages) Converts inputCompletionStage(includingCffu/CompletableFuture) array element byCompletionStage.toCompletableFuture().- Throws:
NullPointerException- if any of the given stages arenull- See Also:
-
completableFutureListToArray
@Contract(pure=true) public static <T> CompletableFuture<T>[] completableFutureListToArray(List<CompletableFuture<T>> cfList) Converts inputCompletableFuturelist to CompletableFuture array.- See Also:
-
unwrapCfException
@Contract(value="null -> null; !null -> !null", pure=true) @Nullable public static Throwable unwrapCfException(@Nullable Throwable ex) Unwraps CompletableFuture exception (CompletionExceptionorExecutionException) to its cause exception. If the input exception is not a CompletableFuture exception or has no cause, returns the input exception itself.
-