Class Cffu<T>
- All Implemented Interfaces:
CompletionStage<T>
,Future<T>
Cffu
is the equivalent class to CompletableFuture
,
contains the equivalent instance methods of CompletionStage
and CompletableFuture
.
The methods that equivalent to static factory methods of CompletableFuture
is in CffuFactory
class.
- Author:
- Jerry Lee (oldratlee at gmail dot com), HuHao (995483610 at qq dot com)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Method Summary
Modifier and TypeMethodDescriptionacceptEither
(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action.acceptEitherAsync
(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied action.acceptEitherAsync
(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action.acceptEitherSuccess
(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action.acceptEitherSuccessAsync
(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied action.acceptEitherSuccessAsync
(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action.<U> Cffu
<U> applyToEither
(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function.<U> Cffu
<U> applyToEitherAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied function.<U> Cffu
<U> applyToEitherAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied function.<U> Cffu
<U> applyToEitherSuccess
(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function.<U> Cffu
<U> applyToEitherSuccessAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied function.<U> Cffu
<U> applyToEitherSuccessAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied function.boolean
cancel
(boolean mayInterruptIfRunning) If not already completed, completes this Cffu with aCancellationException
.Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function.catchingAsync
(Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function, usingdefaultExecutor()
.catchingAsync
(Class<X> exceptionType, Function<? super X, ? extends T> fallback, Executor executor) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function, using the supplied Executor.catchingCompose
(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu.catchingComposeAsync
(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu usingdefaultExecutor()
.catchingComposeAsync
(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback, Executor executor) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu, using the supplied Executor.Returns theCffuFactory
of this Cffu.Returns the computation state (CffuState
).Returns the underlying CompletableFuture.boolean
If not already completed, sets the value returned byget()
and related methods to the given value.completeAsync
(Supplier<? extends T> supplier) Completes this Cffu with the result of the given Supplier function invoked from an asynchronous task usingdefaultExecutor()
.completeAsync
(Supplier<? extends T> supplier, Executor executor) Completes this Cffu with the result of the given Supplier function invoked from an asynchronous task using the given executor.boolean
If not already completed, causes invocations ofget()
and related methods to throw the given exception.completeExceptionallyAsync
(Supplier<? extends Throwable> supplier) If not already completed, completes this Cffu with the exception result of the given Supplier function invoked from an asynchronous task using the default executor.completeExceptionallyAsync
(Supplier<? extends Throwable> supplier, Executor executor) If not already completed, completes this Cffu with the exception result of the given Supplier function invoked from an asynchronous task using the given executor.completeOnTimeout
(T value, long timeout, TimeUnit unit) Returns a new Cffu that is completed normally with the given value when this Cffu is not completed before the given timeout; otherwise the returned Cffu completed with the same successful result or exception of this Cffu.copy()
Returns a new Cffu that is completed normally with the same value as this Cffu when it completes normally.Returns the default Executor used for async methods that do not specify an Executor.exceptionally
(Function<Throwable, ? extends T> fn) Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function.exceptionallyAsync
(Function<Throwable, ? extends T> fn) Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, usingdefaultExecutor()
.exceptionallyAsync
(Function<Throwable, ? extends T> fn, Executor executor) Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using the supplied Executor.exceptionallyCompose
(Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.exceptionallyComposeAsync
(Function<Throwable, ? extends CompletionStage<T>> fn) Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, usingdefaultExecutor()
.exceptionallyComposeAsync
(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor.Returns the exception thrown by the task, without waiting.boolean
ReturnsforbidObtrudeMethods
or not.get()
Waits if necessary for the computation to complete, and then retrieves its result.Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent.int
Returns the estimated number of CompletableFuture(including Cffu wrapper) whose completions are awaiting completion of this Cffu(aka its underlying CompletableFuture).getSuccessNow
(T valueIfNotSuccess) Returns the result value if completed normally, else returns the given valueIfNotSuccess.<U> Cffu
<U> handle
(BiFunction<? super T, Throwable, ? extends U> fn) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed with this cffu's result and exception as arguments to the supplied function.<U> Cffu
<U> handleAsync
(BiFunction<? super T, Throwable, ? extends U> fn) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed usingdefaultExecutor()
, with this cffu's result and exception as arguments to the supplied function.<U> Cffu
<U> handleAsync
(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed using the supplied executor, with this cffu's result and exception as arguments to the supplied function.boolean
Returnstrue
if this Cffu was cancelled before it completed normally.boolean
Returnstrue
if this Cffu completed exceptionally, in any way.boolean
isDone()
Returnstrue
if this task completed.boolean
Returns whether is aminimal stage
or not.join()
Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.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.Returns a new CompletionStage that is completed normally with the same value as this Cffu when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage
.<U> Cffu
<U> Returns a new incomplete Cffu with CompletableFuture of the type to be returned by a CompletionStage method.void
Forcibly causes subsequent invocations of methodget()
and related methods to throw the given exception, whether already completed or not.void
obtrudeValue
(T value) Forcibly sets or resets the value subsequently returned by methodget()
and related methods, whether already completed or not.Returns a new Cffu that is completed exceptionally with aTimeoutException
when this Cffu is not completed before the given timeout; otherwise the returned Cffu completed with the same successful result or exception of this Cffu.peek
(BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action when this cffu completes, returns this cffu.peekAsync
(BiConsumer<? super T, ? super Throwable> action) Peeks the result by executing the given action usingdefaultExecutor()
when this cffu completes, returns this cffu.peekAsync
(BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action using the supplied executor when this cffu completes, returns this cffu.Returns the computed result, without waiting.runAfterBoth
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action.runAfterBothAsync
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action usingdefaultExecutor()
.runAfterBothAsync
(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using the supplied executor.runAfterBothFailFast
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action.runAfterBothFailFastAsync
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action usingdefaultExecutor()
.runAfterBothFailFastAsync
(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using the supplied executor.runAfterEither
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action.runAfterEitherAsync
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action usingdefaultExecutor()
.runAfterEitherAsync
(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using the supplied executor.runAfterEitherSuccess
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action.runAfterEitherSuccessAsync
(CompletionStage<?> other, Runnable action) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action usingdefaultExecutor()
.runAfterEitherSuccessAsync
(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using the supplied executor.state()
Returns the computation state.thenAccept
(Consumer<? super T> action) Returns a new Cffu that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action.thenAcceptAsync
(Consumer<? super T> action) Returns a new Cffu that, when this stage completes normally, is executed usingdefaultExecutor()
, with this stage's result as the argument to the supplied action.thenAcceptAsync
(Consumer<? super T> action, Executor executor) Returns a new Cffu that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied action.thenAcceptBoth
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action.thenAcceptBothAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied action.thenAcceptBothAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action.thenAcceptBothFailFast
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action.thenAcceptBothFailFastAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied action.thenAcceptBothFailFastAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action.<U> Cffu
<U> Returns a new Cffu that, when this stage completes normally, is executed with this stage's result as the argument to the supplied function.<U> Cffu
<U> thenApplyAsync
(Function<? super T, ? extends U> fn) Returns a new Cffu that, when this stage completes normally, is executed usingdefaultExecutor()
, with this stage's result as the argument to the supplied function.<U> Cffu
<U> thenApplyAsync
(Function<? super T, ? extends U> fn, Executor executor) Returns a new Cffu that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied function.<U,
V> Cffu <V> thenCombine
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied function.<U,
V> Cffu <V> thenCombineAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied function.<U,
V> Cffu <V> thenCombineAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.<U,
V> Cffu <V> thenCombineFailFast
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied function.<U,
V> Cffu <V> thenCombineFailFastAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied function.<U,
V> Cffu <V> thenCombineFailFastAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.<U> Cffu
<U> thenCompose
(Function<? super T, ? extends CompletionStage<U>> fn) Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function.<U> Cffu
<U> thenComposeAsync
(Function<? super T, ? extends CompletionStage<U>> fn) Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function, executed usingdefaultExecutor()
.<U> Cffu
<U> thenComposeAsync
(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function, executed using the supplied Executor.thenMAcceptAnyAsync
(Executor executor, Consumer<? super T>... actions) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.thenMAcceptAnyAsync
(Consumer<? super T>... actions) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.thenMAcceptAnySuccessAsync
(Executor executor, Consumer<? super T>... actions) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.thenMAcceptAnySuccessAsync
(Consumer<? super T>... actions) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.thenMAcceptAsync
(Executor executor, Consumer<? super T>... actions) Shortcut to methodallOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.thenMAcceptAsync
(Consumer<? super T>... actions) Shortcut to methodallOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.thenMAcceptFailFastAsync
(Executor executor, Consumer<? super T>... actions) Shortcut to methodallFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.thenMAcceptFailFastAsync
(Consumer<? super T>... actions) Shortcut to methodallFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.thenMApplyAllSuccessAsync
(Executor executor, U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.thenMApplyAllSuccessAsync
(U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.thenMApplyAllSuccessTupleAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(Executor, Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(Executor, Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(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(Executor, Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(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(Executor, Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(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(Object, Function[])
withnull
valueIfFailed.thenMApplyAllSuccessTupleAsync
(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(Object, Function[])
withnull
valueIfFailed.final <U> Cffu
<U> thenMApplyAnyAsync
(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.final <U> Cffu
<U> thenMApplyAnyAsync
(Function<? super T, ? extends U>... fns) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.final <U> Cffu
<U> thenMApplyAnySuccessAsync
(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.final <U> Cffu
<U> thenMApplyAnySuccessAsync
(Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.thenMApplyAsync
(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.thenMApplyAsync
(Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.thenMApplyFailFastAsync
(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.thenMApplyFailFastAsync
(Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.thenMApplyMostSuccessAsync
(Executor executor, U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.thenMApplyMostSuccessAsync
(U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.thenMApplyMostSuccessTupleAsync
(long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyMostSuccessTupleAsync
(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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.thenMApplyTupleAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(Executor, Function[])
.thenMApplyTupleAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(Executor, Function[])
.thenMApplyTupleAsync
(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(Executor, Function[])
.thenMApplyTupleAsync
(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(Executor, Function[])
.thenMApplyTupleAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(Function[])
.thenMApplyTupleAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(Function[])
.thenMApplyTupleAsync
(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(Function[])
.thenMApplyTupleAsync
(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(Function[])
.thenMApplyTupleFailFastAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(Executor, Function[])
.thenMApplyTupleFailFastAsync
(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(Executor, Function[])
.thenMApplyTupleFailFastAsync
(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(Executor, Function[])
.thenMApplyTupleFailFastAsync
(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(Executor, Function[])
.thenMApplyTupleFailFastAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(Function[])
.thenMApplyTupleFailFastAsync
(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(Function[])
.thenMApplyTupleFailFastAsync
(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(Function[])
.thenMApplyTupleFailFastAsync
(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(Function[])
.thenMRunAnyAsync
(Runnable... actions) Shortcut to methodanyOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.thenMRunAnyAsync
(Executor executor, Runnable... actions) Shortcut to methodanyOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.thenMRunAnySuccessAsync
(Runnable... actions) Shortcut to methodanySuccessOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.thenMRunAnySuccessAsync
(Executor executor, Runnable... actions) Shortcut to methodanySuccessOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.thenMRunAsync
(Runnable... actions) Shortcut to methodallOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.thenMRunAsync
(Executor executor, Runnable... actions) Shortcut to methodallOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.thenMRunFailFastAsync
(Runnable... actions) Shortcut to methodallFailFastOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.thenMRunFailFastAsync
(Executor executor, Runnable... actions) Shortcut to methodallFailFastOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.Returns a new Cffu that, when this stage completes normally, executes the given action.thenRunAsync
(Runnable action) Returns a new Cffu that, when this stage completes normally, executes the given action usingdefaultExecutor()
.thenRunAsync
(Runnable action, Executor executor) Returns a new Cffu that, when this stage completes normally, executes the given action using the supplied Executor.Returns aCompletableFuture
maintaining the same completion properties as this Cffu.toString()
Returns a string identifying this Cffu, as well as its completion state.unsafeCompleteOnTimeout
(T value, long timeout, TimeUnit unit) Completes this Cffu with the given value if not otherwise completed before the given timeout.unsafeOrTimeout
(long timeout, TimeUnit unit) Exceptionally completes this Cffu with aTimeoutException
if not otherwise completed before the given timeout.whenComplete
(BiConsumer<? super T, ? super Throwable> action) Returns a new Cffu with the same result or exception as this stage, that executes the given action when this stage completes.whenCompleteAsync
(BiConsumer<? super T, ? super Throwable> action) Returns a new Cffu with the same result or exception as this stage, that executes the given action usingdefaultExecutor()
when this stage completes.whenCompleteAsync
(BiConsumer<? super T, ? super Throwable> action, Executor executor) Returns a new Cffu with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.withCffuFactory
(CffuFactory cffuFactory) Returns a new Cffu with the given CffuFactory(contained configuration).withDefaultExecutor
(Executor defaultExecutor) Returns a new Cffu with the given defaultExecutor.
-
Method Details
-
thenApply
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAccept`") public <U> Cffu<U> thenApply(Function<? super T, ? extends U> fn) Returns a new Cffu that, when this stage completes normally, is executed with this stage's result as the argument to the supplied function.This method is analogous to
Optional.map
andStream.map
.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenApply
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned Cffu
-
thenApplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptAsync`") public <U> Cffu<U> thenApplyAsync(Function<? super T, ? extends U> fn) Returns a new Cffu that, when this stage completes normally, is executed usingdefaultExecutor()
, with this stage's result as the argument to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned Cffu
-
thenApplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptAsync`") public <U> Cffu<U> thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) Returns a new Cffu that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenApplyAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned Cffuexecutor
- the executor to use for asynchronous execution
-
thenAccept
Returns a new Cffu that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAccept
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffu
-
thenAcceptAsync
Returns a new Cffu that, when this stage completes normally, is executed usingdefaultExecutor()
, with this stage's result as the argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffu
-
thenAcceptAsync
Returns a new Cffu that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAcceptAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
thenRun
Returns a new Cffu that, when this stage completes normally, executes the given action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenRun
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffu
-
thenRunAsync
Returns a new Cffu that, when this stage completes normally, executes the given action usingdefaultExecutor()
.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffu
-
thenRunAsync
Returns a new Cffu that, when this stage completes normally, executes the given action using the supplied Executor.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenRunAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform before completing the returned Cffu
-
thenMApplyFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyFailFastAsync(Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
allResultsFailFastOf
documentation for the rules of result computation. -
thenMApplyFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyFailFastAsync(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
allResultsFailFastOf
documentation for the rules of result computation.NOTE: if the
executor
argument is passed by lambda, theRunnable
lambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAllSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAllSuccessAsync(@Nullable U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
allSuccessResultsOf
documentation for the rules of result computation. -
thenMApplyAllSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAllSuccessAsync(Executor executor, @Nullable U valueIfFailed, Function<? super T, ? extends U>... fns) Shortcut to methodallSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
allSuccessResultsOf
documentation for the rules of result computation.NOTE: if the
executor
argument is passed by lambda, theRunnable
lambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyMostSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyMostSuccessAsync(@Nullable U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
mostSuccessResultsOf
documentation for the rules of result computation. -
thenMApplyMostSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyMostSuccessAsync(Executor executor, @Nullable U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T, ? extends U>... fns) Shortcut to methodmostSuccessResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
mostSuccessResultsOf
documentation for the rules of result computation. -
thenMApplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAsync(Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
allResultsOf
documentation for the rules of result computation. -
thenMApplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAsync(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodallResultsOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
allResultsOf
documentation for the rules of result computation.NOTE: if the
executor
argument is passed by lambda, theRunnable
lambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<U> thenMApplyAnySuccessAsync(Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
anySuccessOf
documentation for the rules of result computation. -
thenMApplyAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<U> thenMApplyAnySuccessAsync(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
anySuccessOf
documentation for the rules of result computation.NOTE: if the
executor
argument is passed by lambda, theRunnable
lambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMApplyAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<U> thenMApplyAnyAsync(Function<? super T, ? extends U>... fns) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of functions.See the
anyOf
documentation for the rules of result computation. -
thenMApplyAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final <U> Cffu<U> thenMApplyAnyAsync(Executor executor, Function<? super T, ? extends U>... fns) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of functions.See the
anyOf
documentation for the rules of result computation.NOTE: if the
executor
argument is passed by lambda, theRunnable
lambda parameter type need be declared to avoid the compilation error, more info see the demo code -
thenMAcceptFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptFailFastAsync(Consumer<? super T>... actions) Shortcut to methodallFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.See the
allFailFastOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptFailFastAsync(Executor executor, Consumer<? super T>... actions) Shortcut to methodallFailFastOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.See the
allFailFastOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAsync
Shortcut to methodallOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.See the
allOf
documentation for the rules of result computation.NOTE: if the first 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 final Cffu<Void> thenMAcceptAsync(Executor executor, Consumer<? super T>... actions) Shortcut to methodallOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.See the
allOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptAnySuccessAsync(Consumer<? super T>... actions) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.See the
anySuccessOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptAnySuccessAsync(Executor executor, Consumer<? super T>... actions) Shortcut to methodanySuccessOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.See the
anySuccessOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptAnyAsync(Consumer<? super T>... actions) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier)
; The given stage's result is used as the argument of actions.See the
anyOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMAcceptAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") @SafeVarargs public final Cffu<Void> thenMAcceptAnyAsync(Executor executor, Consumer<? super T>... actions) Shortcut to methodanyOf
, wraps input functions to Cffu byCffuFactory.supplyAsync(Supplier, Executor)
; The given stage's result is used as the argument of actions.See the
anyOf
documentation for the rules of result computation.NOTE: if the first argument is passed by lambda, need declare the lambda parameter type to avoid the compilation error, more info see the demo code
-
thenMRunFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunFailFastAsync(Runnable... actions) Shortcut to methodallFailFastOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.See the
allFailFastOf
documentation for the rules of result computation. -
thenMRunFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunFailFastAsync(Executor executor, Runnable... actions) Shortcut to methodallFailFastOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.See the
allFailFastOf
documentation for the rules of result computation. -
thenMRunAsync
Shortcut to methodallOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.See the
allOf
documentation for the rules of result computation. -
thenMRunAsync
Shortcut to methodallOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.See the
allOf
documentation for the rules of result computation. -
thenMRunAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunAnySuccessAsync(Runnable... actions) Shortcut to methodanySuccessOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.See the
anySuccessOf
documentation for the rules of result computation. -
thenMRunAnySuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunAnySuccessAsync(Executor executor, Runnable... actions) Shortcut to methodanySuccessOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.See the
anySuccessOf
documentation for the rules of result computation. -
thenMRunAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunAnyAsync(Runnable... actions) Shortcut to methodanyOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable)
.See the
anyOf
documentation for the rules of result computation. -
thenMRunAnyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMRunAsync`") public Cffu<Void> thenMRunAnyAsync(Executor executor, Runnable... actions) Shortcut to methodanyOf
, wraps input actions to Cffu byCffuFactory.runAsync(Runnable, Executor)
.See the
anyOf
documentation for the rules of result computation. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyTupleFailFastAsync(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyTupleFailFastAsync(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyFailFastAsync(Executor, Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyTupleFailFastAsyncU3>> (Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyTupleFailFastAsyncU3>> (Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyFailFastAsync(Executor, Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyTupleFailFastAsyncU3, U4>> (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(Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyTupleFailFastAsyncU3, U4>> (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(Executor, Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyTupleFailFastAsyncU3, U4, U5>> (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(Function[])
. -
thenMApplyTupleFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyTupleFailFastAsyncU3, U4, U5>> (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(Executor, Function[])
. -
thenMApplyAllSuccessTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyAllSuccessTupleAsync(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyAllSuccessTupleAsync(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAllSuccessAsync(Executor, Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyAllSuccessTupleAsyncU3>> (Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyAllSuccessTupleAsyncU3>> (Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAllSuccessAsync(Executor, Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyAllSuccessTupleAsyncU3, U4>> (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(Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyAllSuccessTupleAsyncU3, U4>> (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(Executor, Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyAllSuccessTupleAsyncU3, U4, U5>> (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(Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyAllSuccessTupleAsyncU3, U4, U5>> (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(Executor, Object, Function[])
withnull
valueIfFailed.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyMostSuccessTupleAsync(long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyMostSuccessTupleAsync(Executor executor, long timeout, TimeUnit unit, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyMostSuccessAsync(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyMostSuccessTupleAsyncU3>> (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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyMostSuccessTupleAsyncU3>> (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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyMostSuccessTupleAsyncU3, U4>> (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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyMostSuccessTupleAsyncU3, U4>> (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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyMostSuccessTupleAsyncU3, U4, U5>> (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(Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyMostSuccessTupleAsyncU3, U4, U5>> (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(Executor, Object, long, TimeUnit, Function[])
withnull
valueIfNotSuccess.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
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyTupleAsync(Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2> Cffu<Tuple2<U1,U2>> thenMApplyTupleAsync(Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2) Tuple variant ofthenMApplyAsync(Executor, Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyTupleAsyncU3>> (Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple3<U1,U3> U2, thenMApplyTupleAsyncU3>> (Executor executor, Function<? super T, ? extends U1> fn1, Function<? super T, ? extends U2> fn2, Function<? super T, ? extends U3> fn3) Tuple variant ofthenMApplyAsync(Executor, Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyTupleAsyncU3, U4>> (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(Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple4<U1,U3, U4> U2, thenMApplyTupleAsyncU3, U4>> (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(Executor, Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyTupleAsyncU3, U4, U5>> (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(Function[])
. -
thenMApplyTupleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer simple method `thenMAcceptAsync`") public <U1,U2, Cffu<Tuple5<U1,U3, U4, U5> U2, thenMApplyTupleAsyncU3, U4, U5>> (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(Executor, Function[])
. -
thenCombineFailFast
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFailFast`") public <U,V> Cffu<V> thenCombineFailFast(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other 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 Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
thenCombineFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFailFastAsync`") public <U,V> Cffu<V> thenCombineFailFastAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
thenCombineFailFastAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFailFastAsync`") public <U,V> Cffu<V> thenCombineFailFastAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new Cffu that, when this and the other 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 Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffuexecutor
- the executor to use for asynchronous execution
-
thenAcceptBothFailFast
public <U> Cffu<Void> thenAcceptBothFailFast(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other 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 Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
thenAcceptBothFailFastAsync
public <U> Cffu<Void> thenAcceptBothFailFastAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
thenAcceptBothFailFastAsync
public <U> Cffu<Void> thenAcceptBothFailFastAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new Cffu that, when this and the other 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 Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
runAfterBothFailFast
Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action. if any of the given stage complete exceptionally, then the returned Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterBothFailFastAsync
Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action usingdefaultExecutor()
. if any of the given stage complete exceptionally, then the returned Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterBothFailFastAsync
public Cffu<Void> runAfterBothFailFastAsync(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using the supplied executor. if any of the given stage complete exceptionally, then the returned Cffu also does so *without* waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
thenCombine
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBoth`") public <U,V> Cffu<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenCombine
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
thenCombineAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothAsync`") public <U,V> Cffu<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
thenCombineAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothAsync`") public <U,V> Cffu<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenCombineAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's resultV
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffuexecutor
- the executor to use for asynchronous execution
-
thenAcceptBoth
public <U> Cffu<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAcceptBoth
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
thenAcceptBothAsync
public <U> Cffu<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) Returns a new Cffu that, when this and the other given stage both complete normally, is executed usingdefaultExecutor()
, with the two results as arguments to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
thenAcceptBothAsync
public <U> Cffu<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) Returns a new Cffu that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenAcceptBothAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the other CompletionStage's result- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
runAfterBoth
Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterBoth
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterBothAsync
Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action usingdefaultExecutor()
.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterBothAsync
Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using the supplied executor.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterBothAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
applyToEitherSuccess
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEitherSuccess`") public <U> Cffu<U> applyToEitherSuccess(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function.- Type Parameters:
U
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
applyToEitherSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEitherSuccessAsync`") public <U> Cffu<U> applyToEitherSuccessAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied function.- Type Parameters:
U
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
applyToEitherSuccessAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEitherSuccessAsync`") public <U> Cffu<U> applyToEitherSuccessAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, 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:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffuexecutor
- the executor to use for asynchronous execution
-
acceptEitherSuccess
public Cffu<Void> acceptEitherSuccess(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
acceptEitherSuccessAsync
public Cffu<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> other, Consumer<? super T> action) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied action.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
acceptEitherSuccessAsync
public Cffu<Void> acceptEitherSuccessAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
runAfterEitherSuccess
Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action. Otherwise, all two complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterEitherSuccessAsync
Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action usingdefaultExecutor()
. Otherwise, all two complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterEitherSuccessAsync
public Cffu<Void> runAfterEitherSuccessAsync(CompletionStage<?> other, Runnable action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using the supplied executor. Otherwise, all two complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of as its cause.- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
applyToEither
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEither`") public <U> Cffu<U> applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
applyToEither
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
applyToEitherAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEitherAsync`") public <U> Cffu<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffu
-
applyToEitherAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `acceptEitherAsync`") public <U> Cffu<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied function.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
applyToEitherAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
other
- the other CompletionStagefn
- the function to use to compute the value of the returned Cffuexecutor
- the executor to use for asynchronous execution
-
acceptEither
Returns a new Cffu that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
acceptEither
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
acceptEitherAsync
Returns a new Cffu that, when either this or the other given stage complete normally, is executed usingdefaultExecutor()
, with the corresponding result as argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
acceptEitherAsync
public Cffu<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) Returns a new Cffu that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
acceptEitherAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
runAfterEither
Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterEither
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterEitherAsync
Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action usingdefaultExecutor()
.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffu
-
runAfterEitherAsync
Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using the supplied executor.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
runAfterEitherAsync
in interfaceCompletionStage<T>
- Parameters:
other
- the other CompletionStageaction
- the action to perform before completing the returned Cffuexecutor
- the executor to use for asynchronous execution
-
catching
public <X extends Throwable> Cffu<T> catching(Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function. Otherwise, the returned Cffu contains same result as this Cffu."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.- See Also:
-
catchingAsync
public <X extends Throwable> Cffu<T> catchingAsync(Class<X> exceptionType, Function<? super X, ? extends T> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function, usingdefaultExecutor()
. Otherwise, the returned Cffu contains same result as this Cffu."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.- See Also:
-
catchingAsync
public <X extends Throwable> Cffu<T> catchingAsync(Class<X> exceptionType, Function<? super X, ? extends T> fallback, Executor executor) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is executed with the exception from this Cffu as the argument to the supplied function, using the supplied Executor. Otherwise, the returned Cffu contains same result as this Cffu."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.executor
- the executor to use for asynchronous execution- See Also:
-
exceptionally
Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function. Otherwise, if this stage completes normally, then the returned stage also completes normally with the same value.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatching(Class, Function)
instead in your business application.- Specified by:
exceptionally
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the value of the returned Cffu if this Cffu completed exceptionally- See Also:
-
exceptionallyAsync
Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, usingdefaultExecutor()
. Otherwise, if this stage completes normally, then the returned stage also completes normally with the same value.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatchingAsync(Class, Function)
instead in your business application.- Specified by:
exceptionallyAsync
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the value of the returned Cffu if this Cffu completed exceptionally- See Also:
-
exceptionallyAsync
Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using the supplied Executor. Otherwise, if this stage completes normally, then the returned stage also completes normally with the same value.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatchingAsync(Class, Function, Executor)
instead in your business application.- Specified by:
exceptionallyAsync
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the value of the returned Cffu if this Cffu completed exceptionallyexecutor
- the executor to use for asynchronous execution- See Also:
-
orTimeout
Returns a new Cffu that is completed exceptionally with aTimeoutException
when this Cffu is not completed before the given timeout; otherwise the returned Cffu completed with the same successful result or exception of this Cffu.Uses
defaultExecutor()
asexecutorWhenTimeout
.CAUTION: This method returns a new Cffu instead of this Cffu to avoid the subsequent usage of the delay thread; This behavior is DIFFERENT from the original CF method
CompletableFuture#orTimeout
and its backport methodunsafeOrTimeout
. More info see the javadoc ofunsafeOrTimeout
and the demo DelayDysfunctionDemo.- Parameters:
timeout
- how long to wait before completing exceptionally with a TimeoutException, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter
-
unsafeOrTimeout
Exceptionally completes this Cffu with aTimeoutException
if not otherwise completed before the given timeout.CAUTION: This method is UNSAFE!
When the wait timed out, the subsequent non-async actions of the dependent Cffus/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
orTimeout
instead of this method. Using this method is appropriate only when:- the returned Cffu is only read explicitly(e.g. by get/join/resultNow methods), and/or
- all subsequent actions of dependent Cffus/CompletableFutures are guaranteed to execute asynchronously (i.e., the dependent Cffus/CompletableFutures are created using async methods).
Note: Before Java 21(Java 20-),
CompletableFuture#orTimeout
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 ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- this Cffu
- See Also:
-
completeOnTimeout
Returns a new Cffu that is completed normally with the given value when this Cffu is not completed before the given timeout; otherwise the returned Cffu completed with the same successful result or exception of this Cffu.Uses
defaultExecutor()
asexecutorWhenTimeout
.CAUTION: This method returns a new Cffu instead of this Cffu to avoid the subsequent usage of the delay thread; This behavior is DIFFERENT from the original CF method
CompletableFuture#completeOnTimeout
and its backport methodunsafeCompleteOnTimeout
. More info see the javadoc ofunsafeCompleteOnTimeout(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 ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter
-
unsafeCompleteOnTimeout
@Contract("_, _, _ -> this") public Cffu<T> unsafeCompleteOnTimeout(@Nullable T value, long timeout, TimeUnit unit) Completes this Cffu with the given value if not otherwise completed before the given timeout.CAUTION: This method is UNSAFE!
When the wait timed out, the subsequent non-async actions of the dependent Cffus/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
completeOnTimeout
instead of this method. Using this method is appropriate only when:- the returned Cffu is only read explicitly(e.g. by get/join/resultNow methods), and/or
- all subsequent actions of dependent Cffus/CompletableFutures are guaranteed to execute asynchronously (i.e., the dependent Cffus/CompletableFutures are created using async methods).
- Parameters:
value
- the value to use upon timeouttimeout
- how long to wait before completing normally with the given value, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- this Cffu
- See Also:
-
thenCompose
Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function.When this stage completes normally, the given function is invoked with this stage's result as the argument, returning another CompletionStage. When that stage completes normally, the Cffu returned by this method is completed with the same value.
To ensure progress, the supplied function must arrange eventual completion of its result.
This method is analogous to
Optional.flatMap
andStream.flatMap
.See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenCompose
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the returned Cffu's result- Parameters:
fn
- the function to use to compute another CompletionStage
-
thenComposeAsync
Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function, executed usingdefaultExecutor()
.When this stage completes normally, the given function is invoked with this stage's result as the argument, returning another CompletionStage. When that stage completes normally, the Cffu returned by this method is completed with the same value.
To ensure progress, the supplied function must arrange eventual completion of its result.
See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the returned Cffu's result- Parameters:
fn
- the function to use to compute another CompletionStage
-
thenComposeAsync
public <U> Cffu<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) Returns a new Cffu that is completed with the same value as the CompletionStage returned by the given function, executed using the supplied Executor.When this stage completes normally, the given function is invoked with this stage's result as the argument, returning another CompletionStage. When that stage completes normally, the Cffu returned by this method is completed with the same value.
To ensure progress, the supplied function must arrange eventual completion of its result.
See the
CompletionStage
documentation for rules covering exceptional completion.- Specified by:
thenComposeAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the type of the returned Cffu's result- Parameters:
fn
- the function to use to compute another CompletionStageexecutor
- the executor to use for asynchronous execution
-
catchingCompose
public <X extends Throwable> Cffu<T> catchingCompose(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.- See Also:
-
catchingComposeAsync
public <X extends Throwable> Cffu<T> catchingComposeAsync(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu usingdefaultExecutor()
."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.- See Also:
-
catchingComposeAsync
public <X extends Throwable> Cffu<T> catchingComposeAsync(Class<X> exceptionType, Function<? super X, ? extends CompletionStage<T>> fallback, Executor executor) Returns a new Cffu that, when this Cffu completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to the exception from this Cffu, using the supplied Executor."The exception from this Cffu" means the cause of the
ExecutionException
thrown byget()
or, ifget()
throws a different kind of exception, that exception itself; aka the exception is unwrapped byCompletableFutureUtils.unwrapCfException(Throwable)
.- Parameters:
exceptionType
- the exception type that triggers use offallback
. The exception type is matched against the exception from this Cffu. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoidingThrowable.class
in particular.fallback
- the Function to be called if this Cffu fails with the expected exception type. The function's argument is the exception from this Cffu.executor
- the executor to use for asynchronous execution- See Also:
-
exceptionallyCompose
Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatchingCompose(Class, Function)
instead in your business application.- Specified by:
exceptionallyCompose
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the returned CompletionStage if this CompletionStage completed exceptionally- See Also:
-
exceptionallyComposeAsync
Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, usingdefaultExecutor()
.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatchingComposeAsync(Class, Function)
instead in your business application.- Specified by:
exceptionallyComposeAsync
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the returned CompletionStage if this Cffu completed exceptionally- See Also:
-
exceptionallyComposeAsync
public Cffu<T> exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) Returns a new Cffu that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor.Just as catching
Throwable
is not best practice in general, this method handles theThrowable
; Strongly recommend usingcatchingComposeAsync(Class, Function, Executor)
instead in your business application.- Specified by:
exceptionallyComposeAsync
in interfaceCompletionStage<T>
- Parameters:
fn
- the function to use to compute the returned CompletionStage if this Cffu completed exceptionallyexecutor
- the executor to use for asynchronous execution- See Also:
-
handle
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peek`") public <U> Cffu<U> handle(BiFunction<? super T, Throwable, ? extends U> fn) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed with this cffu's result and exception as arguments to the supplied function.When this cffu is complete, the given function is invoked with the result (or
null
if none) and the exception (ornull
if none) of this cffu as arguments, and the function's result is used to complete the returned cffu.- Specified by:
handle
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned Cffu
-
handleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peekAsync`") public <U> Cffu<U> handleAsync(BiFunction<? super T, Throwable, ? extends U> fn) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed usingdefaultExecutor()
, with this cffu's result and exception as arguments to the supplied function.When this Cffu is complete, the given function is invoked with the result (or
null
if none) and the exception (ornull
if none) of this Cffu as arguments, and the function's result is used to complete the returned Cffu.- Specified by:
handleAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned Cffu
-
handleAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peekAsync`") public <U> Cffu<U> handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) Returns a new Cffu that, when this cffu completes either normally or exceptionally, is executed using the supplied executor, with this cffu's result and exception as arguments to the supplied function.When this cffu is complete, the given function is invoked with the result (or
null
if none) and the exception (ornull
if none) of this cffu as arguments, and the function's result is used to complete the returned cffu.- Specified by:
handleAsync
in interfaceCompletionStage<T>
- Type Parameters:
U
- the function's return type- Parameters:
fn
- the function to use to compute the value of the returned cffuexecutor
- the executor to use for asynchronous execution
-
whenComplete
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peek`") public Cffu<T> whenComplete(BiConsumer<? super T, ? super Throwable> action) Returns a new Cffu with the same result or exception as this stage, that executes the given action when this stage completes.When this stage is complete, the given action is invoked with the result (or
null
if none) and the exception (ornull
if none) of this stage as arguments. The returned stage is completed when the action returns.Unlike method
handle
, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: if this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.- Specified by:
whenComplete
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform
-
whenCompleteAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu<T> whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action) Returns a new Cffu with the same result or exception as this stage, that executes the given action usingdefaultExecutor()
when this stage completes.When this stage is complete, the given action is invoked with the result (or
null
if none) and the exception (ornull
if none) of this stage as arguments. The returned stage is completed when the action returns.Unlike method
handleAsync
, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: If this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to perform
-
whenCompleteAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `peekAsync`") public Cffu<T> whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) Returns a new Cffu with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes.When this stage is complete, the given action is invoked with the result (or
null
if none) and the exception (ornull
if none) of this stage as arguments. The returned stage is completed when the action returns.Unlike method
handleAsync
, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: If this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.- Specified by:
whenCompleteAsync
in interfaceCompletionStage<T>
- Parameters:
action
- the action to performexecutor
- the executor to use for asynchronous execution
-
peek
Peeks the result by executing the given action when this cffu completes, returns this cffu.When this cffu is complete, the given action is invoked with the result(or
null
if none) and the exception (ornull
if none) of this cffu as arguments.CAUTION: The return cffu of method
whenComplete(BiConsumer)
will contain DIFFERENT result to this cffu when this cffu completed normally but the supplied action throws an exception. This behavior of methodwhenComplete
is subtle, and common misused if you just want to peek this cffu without affecting the result(e.g. logging the cf result).
For thispeek
method, whether the supplied action throws an exception or not, the result of return cffu(aka. this cffu) is NOT affected.Unlike method
handle(BiFunction)
and like methodwhenComplete(BiConsumer)
, this method is not designed to translate completion outcomes.- Parameters:
action
- the action to perform- Returns:
- this Cffu
- See Also:
-
peekAsync
Peeks the result by executing the given action usingdefaultExecutor()
when this cffu completes, returns this cffu.When this cffu is complete, the given action is invoked with the result(or
null
if none) and the exception (ornull
if none) of this cffu as arguments.CAUTION: The return cffu of method
whenCompleteAsync(BiConsumer)
will contain DIFFERENT result to this cffu when this cffu completed normally but the supplied action throws an exception. This behavior of methodwhenComplete
is subtle, and common misused if you just want to peek this cffu without affecting the result(e.g. logging the cf result).
For thispeek
method, whether the supplied action throws an exception or not, the result of return cffu(aka. this cffu) is NOT affected.Unlike method
handleAsync(BiFunction)
and like methodwhenCompleteAsync(BiConsumer)
, this method is not designed to translate completion outcomes.- Parameters:
action
- the action to perform- Returns:
- this Cffu
- See Also:
-
peekAsync
@Contract("_, _ -> this") public Cffu<T> peekAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) Peeks the result by executing the given action using the supplied executor when this cffu completes, returns this cffu.When this cffu is complete, the given action is invoked with the result(or
null
if none) and the exception (ornull
if none) of this cffu as arguments.CAUTION: The return cffu of method
whenCompleteAsync(BiConsumer, Executor)
will contain DIFFERENT result to this cffu when this cffu completed normally but the supplied action throws an exception. This behavior of methodwhenComplete
is subtle, and common misused if you just want to peek this cffu without affecting the result(e.g. logging the cf result).
For thispeek
method, whether the supplied action throws an exception or not, the result of return cffu(aka. this cffu) is NOT affected.Unlike method
handleAsync(BiFunction, Executor)
and like methodwhenCompleteAsync(BiConsumer, Executor)
, this method is not designed to translate completion outcomes.- Parameters:
action
- the action to perform- Returns:
- this Cffu
- See Also:
-
get
Waits if necessary for the computation to complete, and then retrieves its result.- Specified by:
get
in interfaceFuture<T>
- Returns:
- the computed result
- Throws:
CancellationException
- if the computation was cancelledExecutionException
- if the computation threw an exceptionInterruptedException
- if the current thread was interrupted while waiting
-
get
@Blocking @Nullable public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.- Specified by:
get
in interfaceFuture<T>
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Returns:
- the computed result
- Throws:
CancellationException
- if the computation was cancelledExecutionException
- if the computation threw an exceptionInterruptedException
- if the current thread was interrupted while waitingTimeoutException
- if the wait timed out
-
join
Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.To better conform with the use of common functional forms, if a computation involved in the completion of this Cffu threw an exception, this method throws an (unchecked)
CompletionException
with the underlying exception as its cause.- Returns:
- the result value
- Throws:
CancellationException
- if the computation was cancelledCompletionException
- if this future completed exceptionally or a completion computation threw an exception
-
join
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.CAUTION: if the wait timed out, this method throws an (unchecked)
CompletionException
with theTimeoutException
as its cause; NOT throws a (checked)TimeoutException
likeget(long, TimeUnit)
.NOTE: Calling this method
result = cffu.join(timeout, unit);
is the same as:
result = cffu.copy() // defensive copy to avoid writing this cffu unexpectedly .orTimeout(timeout, unit) .join();
- 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 this future completed exceptionally or a completion computation threw an exception or the wait timed out(with theTimeoutException
as its cause)- See Also:
-
getNow
Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent.- Parameters:
valueIfAbsent
- the value to return if not completed- Returns:
- the result value, if completed, else the given valueIfAbsent
- Throws:
CancellationException
- if the computation was cancelledCompletionException
- if this future completed exceptionally or a completion computation threw an exception- See Also:
-
getSuccessNow
Returns the result value if completed normally, else returns the given valueIfNotSuccess.This method is guaranteed not to throw
CompletionException
,ExecutionException
,CancellationException
andIllegalStateException
.- 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();
- Specified by:
resultNow
in interfaceFuture<T>
- 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.
- Specified by:
exceptionNow
in interfaceFuture<T>
- Returns:
- the exception thrown by the task
- Throws:
IllegalStateException
- if the task has not completed, the task completed normally, or the task was cancelled- See Also:
-
isDone
Returnstrue
if this task completed.Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return
true
. -
isCompletedExceptionally
Returnstrue
if this Cffu completed exceptionally, in any way. Possible causes include cancellation, explicit invocation ofcompleteExceptionally
, and abrupt termination of a CompletionStage action.- Returns:
true
if this Cffu completed exceptionally
-
isCancelled
Returnstrue
if this Cffu was cancelled before it completed normally.- Specified by:
isCancelled
in interfaceFuture<T>
- Returns:
true
if this Cffu was cancelled before it completed normally
-
state
Returns the computation state. This method does not provide Java version compatibility logic; ForJava 18-
, usecffuState()
instead.NOTE: Both
CompletableFuture.state()
method and its return typeFuture.State
were introduced inJava 19
. The dependency on the new return type makes it IMPOSSIBLE to provide backward compatibility through theCffu
wrapper. -
cffuState
Returns the computation state (CffuState
). This method provides equivalent functionality toCompletableFuture.state()
with backwards compatibility forJava 18-
.- Returns:
- the computation state
-
complete
If not already completed, sets the value returned byget()
and related methods to the given value.- Parameters:
value
- the result value- Returns:
true
if this invocation caused this Cffu to transition to a completed state, elsefalse
-
completeAsync
Completes this Cffu with the result of the given Supplier function invoked from an asynchronous task usingdefaultExecutor()
.- Parameters:
supplier
- a function returning the value to be used to complete this Cffu- Returns:
- this Cffu
-
completeAsync
@Contract("_, _ -> this") public Cffu<T> completeAsync(Supplier<? extends T> supplier, Executor executor) Completes this Cffu 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 this Cffuexecutor
- the executor to use for asynchronous execution- Returns:
- this Cffu
-
completeExceptionally
If not already completed, causes invocations ofget()
and related methods to throw the given exception.- Parameters:
ex
- the exception- Returns:
true
if this invocation caused this Cffu to transition to a completed state, elsefalse
-
completeExceptionallyAsync
@Contract("_ -> this") public Cffu<T> completeExceptionallyAsync(Supplier<? extends Throwable> supplier) If not already completed, completes this Cffu with the exception result of the given Supplier function invoked from an asynchronous task using the default executor.- Parameters:
supplier
- a function returning the value to be used to complete this Cffu- Returns:
- this Cffu
-
completeExceptionallyAsync
@Contract("_, _ -> this") public Cffu<T> completeExceptionallyAsync(Supplier<? extends Throwable> supplier, Executor executor) If not already completed, completes this Cffu 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 this Cffuexecutor
- the executor to use for asynchronous execution- Returns:
- this Cffu
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) If not already completed, completes this Cffu with aCancellationException
. Dependent Cffus that have not already completed will also complete exceptionally, with aCompletionException
caused by thisCancellationException
. -
minimalCompletionStage
Returns a new CompletionStage that is completed normally with the same value as this Cffu when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interfaceCompletionStage
. If this Cffu completes exceptionally, then the returned CompletionStage completes exceptionally with a CompletionException with this exception as cause.demo code about re-config methods of Cffu:
cffu2 = cffu .withDefaultExecutor(executor2) // reset to use executor2 .minimalCompletionStage(); // restrict to methods of CompletionStage
CAUTION: if run on old Java 8 (which does not support *minimal* CompletionStage), this method just returns a *normal* Cffu instance which is NOT a *minimal* CompletionStage.
-
withDefaultExecutor
Returns a new Cffu with the given defaultExecutor.Note: The provided defaultExecutor will only affect subsequent newly created Cffu instances, and will not affect this Cffu instance.
demo code about re-config methods of Cffu:
cffu2 = cffu .withDefaultExecutor(executor2) // reset to use executor2 .minimalCompletionStage(); // restrict to methods of CompletionStage
- See Also:
-
withCffuFactory
Returns a new Cffu with the given CffuFactory(contained configuration).Note: The provided CffuFactory configuration will only affect subsequent newly created Cffu instances, and will not affect this Cffu instance.
demo code about re-config methods of Cffu:
cffu2 = cffu .withCffuFactory(cffuFactory2) // reset to use config from cffuFactory2 .minimalCompletionStage(); // restrict to methods of CompletionStage
- Parameters:
cffuFactory
- cffuFactory contained configuration- See Also:
-
toCompletableFuture
Returns aCompletableFuture
maintaining the same completion properties as this Cffu.Calling this method is same as calling the
CompletableFuture.toCompletableFuture()
method of the underlying CompletableFuture:underlyingCf.toCompletableFuture()
;CompletableFutureUtils.toCompletableFutureArray(CompletionStage[])
is the batch operation of this method. If you need the underlying CompletableFuture instance, call methodcffuUnwrap()
.- Specified by:
toCompletableFuture
in interfaceCompletionStage<T>
- Returns:
- the CompletableFuture
- See Also:
-
copy
Returns a new Cffu that is completed normally with the same value as this Cffu when it completes normally. If this Cffu completes exceptionally, then the returned Cffu 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. -
defaultExecutor
Returns the default Executor used for async methods that do not specify an Executor. Config from theCffuFactory.defaultExecutor()
, and can re-configured bywithCffuFactory(CffuFactory)
.- Returns:
- the default executor
- See Also:
-
cffuFactory
Returns theCffuFactory
of this Cffu. This can be re-configured bywithCffuFactory(CffuFactory)
.- Returns:
- the CffuFactory
- See Also:
-
forbidObtrudeMethods
ReturnsforbidObtrudeMethods
or not. This can be re-configured bywithCffuFactory(CffuFactory)
.- See Also:
-
isMinimalStage
Returns whether is aminimal stage
or not.create a
minimal stage
by below methods:CffuFactory.completedStage(Object)
CffuFactory.failedStage(Throwable)
minimalCompletionStage()
CffuFactory.toCffu(CompletionStage)
, this method returns aminimal stage
when input aminimal stage
, otherwise returns a normal stage.
-
getNumberOfDependents
Returns the estimated number of CompletableFuture(including Cffu wrapper) whose completions are awaiting completion of this Cffu(aka its underlying CompletableFuture). This method is designed for use in monitoring system state, not for synchronization control.- Returns:
- the estimated number of dependent CompletableFutures(including Cffu wrapper)
- See Also:
-
obtrudeValue
Forcibly sets or resets the value subsequently returned by methodget()
and related methods, whether already completed or not. This method is designed for use only in error recovery actions, and even in such situations may result in ongoing dependent completions using established versus overwritten outcomes.- Parameters:
value
- the completion value- See Also:
-
obtrudeException
Forcibly causes subsequent invocations of methodget()
and related methods to throw the given exception, whether already completed or not. This method is designed for use only in error recovery actions, and even in such situations may result in ongoing dependent completions using established versus overwritten outcomes.- Parameters:
ex
- the exception- Throws:
NullPointerException
- if the exception is null- See Also:
-
cffuUnwrap
Returns the underlying CompletableFuture.CAUTION: This method is NOT type safe! The returned CompletableFuture may be a minimal-stage. In general, you should NEVER use this method, use
toCompletableFuture()
instead.- Returns:
- the underlying CompletableFuture
- See Also:
-
newIncompleteFuture
Returns a new incomplete Cffu with CompletableFuture of the type to be returned by a CompletionStage method.NOTE: This method existed mainly for API compatibility with
CompletableFuture
, preferCffuFactory.newIncompleteCffu()
.- See Also:
-
toString
Returns a string identifying this Cffu, as well as its completion state.The state, in brackets, contains the String
"Completed Normally"
or the String"Completed Exceptionally"
, or the String"Not completed"
followed by the number of Cffus dependent upon its completion, if any.
-