Class Cffu<T>

java.lang.Object
io.foldright.cffu.Cffu<T>
All Implemented Interfaces:
CompletionStage<T>, Future<T>

public final class Cffu<T> extends Object implements Future<T>, CompletionStage<T>
This class 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 Type
    Method
    Description
    acceptEither(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 using defaultExecutor(), 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 using defaultExecutor(), 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 using defaultExecutor(), 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 using defaultExecutor(), 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 a CancellationException.
    <X extends Throwable>
    Cffu<T>
    catching(Class<X> exceptionType, Function<? super X,? extends T> fallback)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function.
    <X extends Throwable>
    Cffu<T>
    catchingAsync(Class<X> exceptionType, Function<? super X,? extends T> fallback)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function, using the given stage's default asynchronous execution facility.
    <X extends Throwable>
    Cffu<T>
    catchingAsync(Class<X> exceptionType, Function<? super X,? extends T> fallback, Executor executor)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor.
    <X extends Throwable>
    Cffu<T>
    catchingCompose(Class<X> exceptionType, Function<? super X,? extends CompletionStage<T>> fallback)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given stage's exception.
    <X extends Throwable>
    Cffu<T>
    catchingComposeAsync(Class<X> exceptionType, Function<? super X,? extends CompletionStage<T>> fallback)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given stage's exception, using given stage's default asynchronous execution facility.
    <X extends Throwable>
    Cffu<T>
    catchingComposeAsync(Class<X> exceptionType, Function<? super X,? extends CompletionStage<T>> fallback, Executor executor)
    Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given's exception, using the supplied Executor.
    Returns the CffuFactory of this Cffu.
    Returns the computation state(CffuState), this method is equivalent to CompletableFuture.state() with java version compatibility logic, so you can invoke in old java 18-.
    Returns the underlying CompletableFuture.
    boolean
    complete(T value)
    If not already completed, sets the value returned by get() 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 using defaultExecutor().
    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 of get() and related methods to throw the given exception.
    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)
    Completes this Cffu with the given value if not otherwise completed before the given timeout.
    completeOnTimeout(T value, Executor executorWhenTimeout, long timeout, TimeUnit unit)
    Completes this Cffu with the given value if not otherwise completed before the given timeout.
    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.
    Returns a new Cffu that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function.
    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 defaultExecutor().
    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.
    Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception.
    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 defaultExecutor().
    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
    Returns forbidObtrudeMethods or not.
    get()
    Waits if necessary for the computation to complete, and then retrieves its result.
    get(long timeout, TimeUnit unit)
    Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
    getNow(T valueIfAbsent)
    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 successfully, 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 using defaultExecutor(), 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
    Returns true if this Cffu was cancelled before it completed normally.
    boolean
    Returns true if this Cffu completed exceptionally, in any way.
    boolean
    Returns true if this task completed.
    boolean
    Returns whether is a minimal stage or not.
    Returns the result value when complete, or throws an (unchecked) exception if completed exceptionally.
    join(long timeout, TimeUnit unit)
    Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.
    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 interface CompletionStage.
    <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 method get() 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 method get() and related methods, whether already completed or not.
    orTimeout(long timeout, TimeUnit unit)
    Exceptionally completes this Cffu with a TimeoutException if not otherwise completed before the given timeout.
    orTimeout(Executor executorWhenTimeout, long timeout, TimeUnit unit)
    Exceptionally completes this Cffu with a TimeoutException if not otherwise completed before the given timeout.
    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 when this cffu completes, executes the given action using defaultExecutor(), returns this cffu.
    peekAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)
    Peeks the result by executing the given action when this cffu completes, that executes the given action using the supplied Executor when this cffu completes, returns this cffu.
    Returns a new Cffu with the given CffuFactory(contained configuration).
    resetDefaultExecutor(Executor defaultExecutor)
    Returns a new Cffu with the given defaultExecutor.
    Returns the computed result, without waiting.
    Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action.
    Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using defaultExecutor().
    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.
    Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action.
    Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using defaultExecutor().
    Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using the supplied executor.
    Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action.
    Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using defaultExecutor().
    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.
    Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action.
    Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using defaultExecutor().
    Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using the supplied executor.
    Returns the computation state, this method contains NO java version compatibility logic, if you need this function in old java 18-, use cffuState() instead.
    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 using defaultExecutor(), 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.
    <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.
    <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 using defaultExecutor(), with the two results as arguments to the supplied action.
    <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.
    <U> Cffu<Void>
    thenAcceptBothFastFail(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.
    <U> Cffu<Void>
    thenAcceptBothFastFailAsync(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 using defaultExecutor(), with the two results as arguments to the supplied action.
    <U> Cffu<Void>
    thenAcceptBothFastFailAsync(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>
    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.
    <U> Cffu<U>
    thenApplyAsync(Function<? super T,? extends U> fn)
    Returns a new Cffu that, when this stage completes normally, is executed using defaultExecutor(), 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 using defaultExecutor(), 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>
    thenCombineFastFail(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>
    thenCombineFastFailAsync(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 using defaultExecutor(), with the two results as arguments to the supplied function.
    <U, V> Cffu<V>
    thenCombineFastFailAsync(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 using defaultExecutor().
    <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.
    final Cffu<Void>
    thenMAcceptAnyAsync(Executor executor, Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptAnyAsync(Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptAnySuccessAsync(Executor executor, Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptAnySuccessAsync(Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptAsync(Executor executor, Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptAsync(Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptFastFailAsync(Executor executor, Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
    final Cffu<Void>
    thenMAcceptFastFailAsync(Consumer<? super T>... actions)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
    final <U> Cffu<List<U>>
    thenMApplyAllSuccessAsync(U valueIfFailed, Executor executor, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed in the given Executor with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyAllSuccessAsync(U valueIfFailed, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed in the Cffu's default asynchronous execution facility with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<U>
    thenMApplyAnyAsync(Executor executor, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with any completed result obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    final <U> Cffu<U>
    thenMApplyAnyAsync(Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the Cffu's default asynchronous execution facility, with any completed result obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    final <U> Cffu<U>
    thenMApplyAnySuccessAsync(Executor executor, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with any successful value obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    final <U> Cffu<U>
    thenMApplyAnySuccessAsync(Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the Cffu's default asynchronous execution facility, with any successful value obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    final <U> Cffu<List<U>>
    thenMApplyAsync(Executor executor, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyAsync(Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyFastFailAsync(Executor executor, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyFastFailAsync(Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyMostSuccessAsync(U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the most values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the given time(timeout, aka as many results as possible in the given time) in the same order of the given Functions arguments.
    final <U> Cffu<List<U>>
    thenMApplyMostSuccessAsync(U valueIfNotSuccess, Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U>... fns)
    Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the most values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the given time(timeout, aka as many results as possible in the given time) in the same order of the given Functions arguments.
    Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
    thenMRunAnyAsync(Executor executor, Runnable... actions)
    Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
    Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
    thenMRunAnySuccessAsync(Executor executor, Runnable... actions)
    Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
    thenMRunAsync(Runnable... actions)
    Returns a new Cffu that, when the given stage completes normally, executes the given actions using defaultExecutor().
    thenMRunAsync(Executor executor, Runnable... actions)
    Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
    Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
    thenMRunFastFailAsync(Executor executor, Runnable... actions)
    Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
    thenRun(Runnable action)
    Returns a new Cffu that, when this stage completes normally, executes the given action.
    Returns a new Cffu that, when this stage completes normally, executes the given action using defaultExecutor().
    thenRunAsync(Runnable action, Executor executor)
    Returns a new Cffu that, when this stage completes normally, executes the given action using the supplied Executor.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyAllSuccessAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyAllSuccessAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyAllSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyAllSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyAllSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyFastFailAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyFastFailAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyFastFailAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyFastFailAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyFastFailAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyMostSuccessAsync(long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyMostSuccessAsync(long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyMostSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyMostSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2> Cffu<Tuple2<U1,U2>>
    thenTupleMApplyMostSuccessAsync(Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3>
    Cffu<Tuple3<U1,U2,U3>>
    thenTupleMApplyMostSuccessAsync(Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4>
    Cffu<Tuple4<U1,U2,U3,U4>>
    thenTupleMApplyMostSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    <U1, U2, U3, U4, U5>
    Cffu<Tuple5<U1,U2,U3,U4,U5>>
    thenTupleMApplyMostSuccessAsync(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)
    Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
    Returns a CompletableFuture maintaining the same completion properties as this Cffu.
    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 a TimeoutException 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 using defaultExecutor() 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • thenApply

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenRun`") 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 and Stream.map.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenApply in interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new Cffu
    • thenApplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenRunAsync`") public <U> Cffu<U> thenApplyAsync(Function<? super T,? extends U> fn)
      Returns a new Cffu that, when this stage completes normally, is executed using defaultExecutor(), 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 interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new Cffu
    • thenApplyAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenRunAsync`") 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 interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenAccept

      public Cffu<Void> 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.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenAccept in interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenAcceptAsync

      public Cffu<Void> thenAcceptAsync(Consumer<? super T> action)
      Returns a new Cffu that, when this stage completes normally, is executed using defaultExecutor(), 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 interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenAcceptAsync

      public Cffu<Void> 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.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenAcceptAsync in interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenRun

      public Cffu<Void> thenRun(Runnable action)
      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 interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenRunAsync

      public Cffu<Void> thenRunAsync(Runnable action)
      Returns a new Cffu that, when this stage completes normally, executes the given action using defaultExecutor().

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenRunAsync in interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenRunAsync

      public Cffu<Void> thenRunAsync(Runnable action, Executor executor)
      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 interface CompletionStage<T>
      Parameters:
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyFastFailAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyFastFailAsync(Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
      Type Parameters:
      U - the functions' return type
      Parameters:
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyFastFailAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyFastFailAsync(Executor executor, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
      Type Parameters:
      U - the functions' return type
      Parameters:
      executor - the executor to use for asynchronous execution
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAllSuccessAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAllSuccessAsync(@Nullable U valueIfFailed, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed in the Cffu's default asynchronous execution facility with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.

      If any of the provided functions fails, its corresponding position will contain valueIfFailed.

      Type Parameters:
      U - the functions' return type
      Parameters:
      valueIfFailed - the value to return if not completed successfully
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAllSuccessAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAllSuccessAsync(@Nullable U valueIfFailed, Executor executor, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed in the given Executor with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.

      If any of the provided functions fails, its corresponding position will contain valueIfFailed.

      Type Parameters:
      U - the functions' return type
      Parameters:
      valueIfFailed - the value to return if not completed successfully
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyMostSuccessAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyMostSuccessAsync(@Nullable U valueIfNotSuccess, long timeout, TimeUnit unit, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the most values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the given time(timeout, aka as many results as possible in the given time) in the same order of the given Functions arguments.

      If any of the provided functions does not success(fails or incomplete) in given time, its corresponding position will contain valueIfNotSuccess.

      Type Parameters:
      U - the functions' return type
      Parameters:
      valueIfNotSuccess - the value to return if not completed successfully
      timeout - how long to wait in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyMostSuccessAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyMostSuccessAsync(@Nullable U valueIfNotSuccess, Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the most values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the given time(timeout, aka as many results as possible in the given time) in the same order of the given Functions arguments.

      If any of the provided functions does not success(fails or incomplete) in given time, its corresponding position will contain valueIfNotSuccess.

      Type Parameters:
      U - the functions' return type
      Parameters:
      valueIfNotSuccess - the value to return if not completed successfully
      executor - the executor to use for asynchronous execution
      timeout - how long to wait in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAsync(Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
      Type Parameters:
      U - the functions' return type
      Parameters:
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAsync

      @SafeVarargs public final <U> Cffu<List<U>> thenMApplyAsync(Executor executor, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the values obtained by calling the given Functions (with the given stage's result as the argument to the given functions) in the same order of the given Functions arguments.
      Type Parameters:
      U - the functions' return type
      Parameters:
      executor - the executor to use for asynchronous execution
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAnySuccessAsync

      @SafeVarargs public final <U> Cffu<U> thenMApplyAnySuccessAsync(Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the Cffu's default asynchronous execution facility, with any successful value obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
      Type Parameters:
      U - the functions' return type
      Parameters:
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAnySuccessAsync

      @SafeVarargs public final <U> Cffu<U> thenMApplyAnySuccessAsync(Executor executor, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with any successful value obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
      Type Parameters:
      U - the functions' return type
      Parameters:
      executor - the executor to use for asynchronous execution
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAnyAsync

      @SafeVarargs public final <U> Cffu<U> thenMApplyAnyAsync(Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the Cffu's default asynchronous execution facility, with any completed result obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
      Type Parameters:
      U - the functions' return type
      Parameters:
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMApplyAnyAsync

      @SafeVarargs public final <U> Cffu<U> thenMApplyAnyAsync(Executor executor, Function<? super T,? extends U>... fns)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with any completed result obtained by calling the given Functions (with the given stage's result as the argument to the given functions).
      Type Parameters:
      U - the functions' return type
      Parameters:
      executor - the executor to use for asynchronous execution
      fns - the functions to use to compute the values of the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptFastFailAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptFastFailAsync(Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptFastFailAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptFastFailAsync(Executor executor, Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAsync(Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAsync(Executor executor, Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAnySuccessAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAnySuccessAsync(Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAnySuccessAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAnySuccessAsync(Executor executor, Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAnyAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAnyAsync(Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using defaultExecutor(), with the given stage's result as the argument to the given actions.
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMAcceptAnyAsync

      @SafeVarargs public final Cffu<Void> thenMAcceptAnyAsync(Executor executor, Consumer<? super T>... actions)
      Returns a new Cffu that, when the given stage completes normally, is executed using the given Executor, with the given stage's result as the argument to the given actions.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunFastFailAsync

      public Cffu<Void> thenMRunFastFailAsync(Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunFastFailAsync

      public Cffu<Void> thenMRunFastFailAsync(Executor executor, Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAsync

      public Cffu<Void> thenMRunAsync(Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes the given actions using defaultExecutor().
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAsync

      public Cffu<Void> thenMRunAsync(Executor executor, Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAnySuccessAsync

      public Cffu<Void> thenMRunAnySuccessAsync(Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAnySuccessAsync

      public Cffu<Void> thenMRunAnySuccessAsync(Executor executor, Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAnyAsync

      public Cffu<Void> thenMRunAnyAsync(Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes using defaultExecutor(),
      Parameters:
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenMRunAnyAsync

      public Cffu<Void> thenMRunAnyAsync(Executor executor, Runnable... actions)
      Returns a new Cffu that, when the given stage completes normally, executes the given actions using the given Executor.
      Parameters:
      executor - the executor to use for asynchronous execution
      actions - the actions to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyFastFailAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyFastFailAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyFastFailAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyFastFailAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyFastFailAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyFastFailAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyFastFailAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyAllSuccessAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyAllSuccessAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyAllSuccessAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyAllSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyAllSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Returns:
      the new Cffu
    • thenTupleMApplyAllSuccessAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyAllSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the successful values obtained by calling the given Functions (with the given stage's result as the argument to the given functions).

      If any of the provided functions fails, its corresponding position will contain null (which is indistinguishable from the function having a successful value of null).

      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyMostSuccessAsync(long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyMostSuccessAsync(Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyMostSuccessAsync(long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyMostSuccessAsync(Executor executor, long timeout, TimeUnit unit, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyMostSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyMostSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyMostSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyMostSuccessAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyMostSuccessAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2> Cffu<Tuple2<U1,U2>> thenTupleMApplyAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3> Cffu<Tuple3<U1,U2,U3>> thenTupleMApplyAsync(Executor executor, Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyAsync(Function<? super T,? extends U1> fn1, Function<? super T,? extends U2> fn2, Function<? super T,? extends U3> fn3, Function<? super T,? extends U4> fn4)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3, U4> Cffu<Tuple4<U1,U2,U3,U4>> thenTupleMApplyAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the defaultExecutor(), with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Returns:
      the new Cffu
    • thenTupleMApplyAsync

      public <U1, U2, U3, U4, U5> Cffu<Tuple5<U1,U2,U3,U4,U5>> thenTupleMApplyAsync(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)
      Returns a new Cffu that, when this Cffu completes normally, is executed using the supplied Executor, with the values obtained by calling the given Functions (with this Cffu's result as the argument to the given functions) in the same order of the given Functions arguments.
      Parameters:
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenCombineFastFail

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFastFail`") public <U, V> Cffu<V> thenCombineFastFail(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 result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new Cffu
    • thenCombineFastFailAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFastFailAsync`") public <U, V> Cffu<V> thenCombineFastFailAsync(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 using defaultExecutor(), 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 result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new Cffu
    • thenCombineFastFailAsync

      @CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `thenAcceptBothFastFailAsync`") public <U, V> Cffu<V> thenCombineFastFailAsync(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 result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • thenAcceptBothFastFail

      public <U> Cffu<Void> thenAcceptBothFastFail(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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenAcceptBothFastFailAsync

      public <U> Cffu<Void> thenAcceptBothFastFailAsync(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 using defaultExecutor(), 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • thenAcceptBothFastFailAsync

      public <U> Cffu<Void> thenAcceptBothFastFailAsync(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 CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • runAfterBothFastFail

      public Cffu<Void> runAfterBothFastFail(CompletionStage<?> other, Runnable action)
      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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterBothFastFailAsync

      public Cffu<Void> runAfterBothFastFailAsync(CompletionStage<?> other, Runnable action)
      Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using defaultExecutor(). 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterBothFastFailAsync

      public Cffu<Void> runAfterBothFastFailAsync(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 CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), with the two results as arguments to the supplied function.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenCombineAsync in interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      V - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), with the two results as arguments to the supplied action.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenAcceptBothAsync in interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the other CompletionStage's result
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • runAfterBoth

      public Cffu<Void> runAfterBoth(CompletionStage<?> other, Runnable action)
      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 interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterBothAsync

      public Cffu<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action)
      Returns a new Cffu that, when this and the other given stage both complete normally, executes the given action using defaultExecutor().

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      runAfterBothAsync in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterBothAsync

      public Cffu<Void> 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.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      runAfterBothAsync in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), with the corresponding result as argument to the supplied function.
      Type Parameters:
      U - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), with the corresponding result as argument to the supplied action.
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • runAfterEitherSuccess

      public Cffu<Void> runAfterEitherSuccess(CompletionStage<?> other, Runnable action)
      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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterEitherSuccessAsync

      public Cffu<Void> runAfterEitherSuccessAsync(CompletionStage<?> other, Runnable action)
      Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using defaultExecutor(). 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), with the corresponding result as argument to the supplied function.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      applyToEitherAsync in interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      other - the other CompletionStage
      fn - the function to use to compute the value of the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • acceptEither

      public Cffu<Void> acceptEither(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.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      acceptEither in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • acceptEitherAsync

      public Cffu<Void> 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 using defaultExecutor(), with the corresponding result as argument to the supplied action.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      acceptEitherAsync in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new 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 interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • runAfterEither

      public Cffu<Void> runAfterEither(CompletionStage<?> other, Runnable action)
      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 interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterEitherAsync

      public Cffu<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action)
      Returns a new Cffu that, when either this or the other given stage complete normally, executes the given action using defaultExecutor().

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      runAfterEitherAsync in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      Returns:
      the new Cffu
    • runAfterEitherAsync

      public Cffu<Void> 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.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      runAfterEitherAsync in interface CompletionStage<T>
      Parameters:
      other - the other CompletionStage
      action - the action to perform before completing the returned Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • catching

      public <X extends Throwable> Cffu<T> catching(Class<X> exceptionType, Function<? super X,? extends T> fallback)
      Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function. Otherwise, the returned stage contains same result as input Cffu.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      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 given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function, using the given stage's default asynchronous execution facility. Otherwise, the returned stage contains same result as input Cffu.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      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 given stage completes exceptionally with the given exceptionType, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor. Otherwise, the returned stage contains same result as input Cffu.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      executor - the executor to use for asynchronous execution
      See Also:
    • exceptionally

      public Cffu<T> 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. 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 the Throwable; Strong recommend using catching(Class, Function) instead in your biz application.

      Specified by:
      exceptionally in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the value of the returned Cffu if this Cffu completed exceptionally
      Returns:
      the new Cffu
      See Also:
    • exceptionallyAsync

      public Cffu<T> 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, using defaultExecutor(). 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 the Throwable; Strong recommend using catchingAsync(Class, Function) instead in your biz application.

      Specified by:
      exceptionallyAsync in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the value of the returned Cffu if this Cffu completed exceptionally
      Returns:
      the new Cffu
      See Also:
    • exceptionallyAsync

      public Cffu<T> 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. 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 the Throwable; Strong recommend using catchingAsync(Class, Function, Executor) instead in your biz application.

      Specified by:
      exceptionallyAsync in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the value of the returned Cffu if this Cffu completed exceptionally
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
      See Also:
    • orTimeout

      public Cffu<T> orTimeout(long timeout, TimeUnit unit)
      Exceptionally completes this Cffu with a TimeoutException if not otherwise completed before the given timeout.

      Uses defaultExecutor() as executorWhenTimeout.

      Parameters:
      timeout - how long to wait before completing exceptionally with a TimeoutException, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      the new Cffu
      See Also:
    • orTimeout

      public Cffu<T> orTimeout(Executor executorWhenTimeout, long timeout, TimeUnit unit)
      Exceptionally completes this Cffu with a TimeoutException if not otherwise completed before the given timeout.
      Parameters:
      executorWhenTimeout - the async executor when triggered by timeout
      timeout - how long to wait before completing exceptionally with a TimeoutException, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      the new Cffu
    • unsafeOrTimeout

      @Contract("_, _ -> this") public Cffu<T> unsafeOrTimeout(long timeout, TimeUnit unit)
      Exceptionally completes this Cffu with a TimeoutException if not otherwise completed before the given timeout.

      CAUTION: This method is UNSAFE!

      When triggered by timeout, the subsequent non-async actions of the dependent cfs are performed in the SINGLE thread builtin executor of CompletableFuture for delay execution(including timeout function). So the long-running subsequent non-async actions lead to the CompletableFuture dysfunction (including delay execution and timeout).

      Strong recommend using the safe method orTimeout(long, TimeUnit) instead of this method.

      Unless all subsequent actions of dependent cfs is ensured executing async (aka. the dependent cfs is created by async methods), using this method is one less thread switch of task execution when triggered by timeout.

      Parameters:
      timeout - how long to wait before completing exceptionally with a TimeoutException, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      this Cffu
      See Also:
    • completeOnTimeout

      public Cffu<T> completeOnTimeout(@Nullable T value, long timeout, TimeUnit unit)
      Completes this Cffu with the given value if not otherwise completed before the given timeout.

      Uses defaultExecutor() as executorWhenTimeout.

      Parameters:
      value - the value to use upon timeout
      timeout - how long to wait before completing normally with the given value, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      the new Cffu
      See Also:
    • completeOnTimeout

      public Cffu<T> completeOnTimeout(@Nullable T value, Executor executorWhenTimeout, long timeout, TimeUnit unit)
      Completes this Cffu with the given value if not otherwise completed before the given timeout.
      Parameters:
      value - the value to use upon timeout
      executorWhenTimeout - the async executor when triggered by timeout
      timeout - how long to wait before completing normally with the given value, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      the new Cffu
    • 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 triggered by timeout, the subsequent non-async actions of the dependent cfs are performed in the SINGLE thread builtin executor of CompletableFuture for delay execution (including timeout function). So the long-running subsequent non-async actions lead to the CompletableFuture dysfunction (including delay execution and timeout).

      Strong recommend using the safe method completeOnTimeout(Object, long, TimeUnit) instead of this method.

      Unless all subsequent actions of dependent cfs is ensured executing async (aka. the dependent cfs is created by async methods), using this method is one less thread switch of task execution when triggered by timeout.

      Parameters:
      value - the value to use upon timeout
      timeout - how long to wait before completing normally with the given value, in units of unit
      unit - a TimeUnit determining how to interpret the timeout parameter
      Returns:
      this Cffu
      See Also:
    • thenCompose

      public <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.

      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 and Stream.flatMap.

      See the CompletionStage documentation for rules covering exceptional completion.

      Specified by:
      thenCompose in interface CompletionStage<T>
      Type Parameters:
      U - the type of the returned Cffu's result
      Parameters:
      fn - the function to use to compute another CompletionStage
      Returns:
      the new Cffu
    • thenComposeAsync

      public <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 using defaultExecutor().

      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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the returned Cffu's result
      Parameters:
      fn - the function to use to compute another CompletionStage
      Returns:
      the new Cffu
    • 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 interface CompletionStage<T>
      Type Parameters:
      U - the type of the returned Cffu's result
      Parameters:
      fn - the function to use to compute another CompletionStage
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • catchingCompose

      public <X extends Throwable> Cffu<T> catchingCompose(Class<X> exceptionType, Function<? super X,? extends CompletionStage<T>> fallback)
      Returns a new Cffu that, when given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given stage's exception.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      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 given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given stage's exception, using given stage's default asynchronous execution facility.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      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 given stage completes exceptionally with the given exceptionType, is composed using the results of the supplied function applied to given's exception, using the supplied Executor.
      Parameters:
      exceptionType - the exception type that triggers use of fallback. The exception type is matched against the input's exception. To avoid hiding bugs and other unrecoverable errors, callers should prefer more specific types, avoiding Throwable.class in particular.
      fallback - the Function to be called if input fails with the expected exception type. The function's argument is the input's exception.
      executor - the executor to use for asynchronous execution
      See Also:
    • exceptionallyCompose

      public Cffu<T> exceptionallyCompose(Function<Throwable,? extends CompletionStage<T>> fn)
      Returns a new CompletionStage 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 the Throwable; Strong recommend using catchingCompose(Class, Function) instead in your biz application.

      Specified by:
      exceptionallyCompose in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the returned CompletionStage if this CompletionStage completed exceptionally
      Returns:
      the new CompletionStage
      See Also:
    • exceptionallyComposeAsync

      public Cffu<T> 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, using defaultExecutor().

      Just as catching Throwable is not best practice in general, this method handles the Throwable; Strong recommend using catchingComposeAsync(Class, Function) instead in your biz application.

      Specified by:
      exceptionallyComposeAsync in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the returned CompletionStage if this Cffu completed exceptionally
      Returns:
      the new Cffu
      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 the Throwable; Strong recommend using catchingComposeAsync(Class, Function, Executor) instead in your biz application.

      Specified by:
      exceptionallyComposeAsync in interface CompletionStage<T>
      Parameters:
      fn - the function to use to compute the returned CompletionStage if this Cffu completed exceptionally
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
      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 (or null if none) of this cffu as arguments, and the function's result is used to complete the returned cffu.

      Specified by:
      handle in interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 using defaultExecutor(), 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 (or null if none) of this Cffu as arguments, and the function's result is used to complete the returned Cffu.

      Specified by:
      handleAsync in interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned Cffu
      Returns:
      the new 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 (or null if none) of this cffu as arguments, and the function's result is used to complete the returned cffu.

      Specified by:
      handleAsync in interface CompletionStage<T>
      Type Parameters:
      U - the function's return type
      Parameters:
      fn - the function to use to compute the value of the returned cffu
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • 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 (or null 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 interface CompletionStage<T>
      Parameters:
      action - the action to perform
      Returns:
      the new Cffu
    • 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 using defaultExecutor() when this stage completes.

      When this stage is complete, the given action is invoked with the result (or null if none) and the exception (or null 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 interface CompletionStage<T>
      Parameters:
      action - the action to perform
      Returns:
      the new Cffu
    • 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 (or null 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 interface CompletionStage<T>
      Parameters:
      action - the action to perform
      executor - the executor to use for asynchronous execution
      Returns:
      the new Cffu
    • peek

      @Contract("_ -> this") public Cffu<T> peek(BiConsumer<? super T,? super Throwable> action)
      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 (or null if none) of this cffu as arguments. Whether the supplied action throws an exception or not, this cffu is NOT affected.

      Unlike method handle and like method whenComplete, 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)
      Peeks the result by executing the given action when this cffu completes, executes the given action using defaultExecutor(), returns this cffu.

      When this cffu is complete, the given action is invoked with the result (or null if none) and the exception (or null if none) of this cffu as arguments. Whether the supplied action throws an exception or not, this cffu is NOT affected.

      Unlike method handle and like method whenComplete, 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 when this cffu completes, that executes 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 (or null if none) of this cffu as arguments. Whether the supplied action throws an exception or not, this cffu is NOT affected.

      Unlike method handle and like method whenComplete, 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 interface Future<T>
      Returns:
      the computed result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
    • get

      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 interface Future<T>
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      the computed result
      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
      InterruptedException - if the current thread was interrupted while waiting
      TimeoutException - if the wait timed out
    • join

      @Blocking @Nullable public T 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 cancelled
      CompletionException - if this future completed exceptionally or a completion computation threw an exception
    • join

      @Blocking @Nullable public T join(long timeout, TimeUnit unit)
      Waits if necessary for at most the given time for the computation to complete, and then retrieves its result value when complete, or throws an (unchecked) exception if completed exceptionally.

      NOTE:
      Calling this method

      result = cffu.join(timeout, unit);

      is the same as:

      result = cffu.copy() // defensive copy to avoid writing this cffu unexpectedly
           .orTimeout(timeout, unit)
           .join();
       
      CAUTION:
      if the wait timed out, this method throws an (unchecked) CompletionException with the TimeoutException as its cause; NOT throws a (checked) TimeoutException like get(long, TimeUnit).
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      the result value
      Throws:
      CancellationException - if the computation was cancelled
      CompletionException - if this future completed exceptionally or a completion computation threw an exception or the wait timed out(with the TimeoutException as its cause)
      See Also:
    • getNow

      @Contract(pure=true) @Nullable public T getNow(T valueIfAbsent)
      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 cancelled
      CompletionException - if this future completed exceptionally or a completion computation threw an exception
      See Also:
    • getSuccessNow

      @Contract(pure=true) @Nullable public T getSuccessNow(@Nullable T valueIfNotSuccess)
      Returns the result value if completed successfully, else returns the given valueIfNotSuccess.

      This method will not throw exceptions (CancellationException/CompletionException/ExecutionException/IllegalStateException/...).

      Parameters:
      valueIfNotSuccess - the value to return if not completed successfully
      Returns:
      the result value, if completed successfully, else the given valueIfNotSuccess
    • resultNow

      @Contract(pure=true) @Nullable public T resultNow()
      Returns the computed result, without waiting.

      This method is for cases where the caller knows that the task has already completed successfully, 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 interface Future<T>
      Returns:
      the computed result
      Throws:
      IllegalStateException - if the task has not completed or the task did not complete with a result
    • exceptionNow

      @Contract(pure=true) public Throwable 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 interface Future<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

      @Contract(pure=true) public boolean isDone()
      Returns true 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.

      Specified by:
      isDone in interface Future<T>
      Returns:
      true if this task completed
    • isCompletedExceptionally

      @Contract(pure=true) public boolean isCompletedExceptionally()
      Returns true if this Cffu completed exceptionally, in any way. Possible causes include cancellation, explicit invocation of completeExceptionally, and abrupt termination of a CompletionStage action.
      Returns:
      true if this Cffu completed exceptionally
    • isCancelled

      @Contract(pure=true) public boolean isCancelled()
      Returns true if this Cffu was cancelled before it completed normally.
      Specified by:
      isCancelled in interface Future<T>
      Returns:
      true if this Cffu was cancelled before it completed normally
    • state

      @Contract(pure=true) public Future.State state()
      Returns the computation state, this method contains NO java version compatibility logic, if you need this function in old java 18-, use cffuState() instead.

      NOTE:
      CompletableFuture.state() is new method since Java 19, this method should have compatibility logic for old Java version; But the return type Future.State is also added since Java 19, so it's IMPOSSIBLE to backport by compatibility logic of wrapper class(Cffu).

      Specified by:
      state in interface Future<T>
      Returns:
      the computation state
      See Also:
    • cffuState

      @Contract(pure=true) public CffuState cffuState()
      Returns the computation state(CffuState), this method is equivalent to CompletableFuture.state() with java version compatibility logic, so you can invoke in old java 18-.
      Returns:
      the computation state
    • complete

      public boolean complete(@Nullable T value)
      If not already completed, sets the value returned by get() 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, else false
    • completeAsync

      @Contract("_ -> this") public Cffu<T> completeAsync(Supplier<? extends T> supplier)
      Completes this Cffu with the result of the given Supplier function invoked from an asynchronous task using defaultExecutor().
      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 Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      this Cffu
    • completeExceptionally

      public boolean completeExceptionally(Throwable ex)
      If not already completed, causes invocations of get() 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, else false
    • 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 Cffu
      executor - the executor to use for asynchronous execution
      Returns:
      this Cffu
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      If not already completed, completes this Cffu with a CancellationException. Dependent Cffus that have not already completed will also complete exceptionally, with a CompletionException caused by this CancellationException.
      Specified by:
      cancel in interface Future<T>
      Parameters:
      mayInterruptIfRunning - this value has no effect in this implementation because interrupts are not used to control processing.
      Returns:
      true if this task is now cancelled
    • minimalCompletionStage

      @Contract(pure=true) public CompletionStage<T> 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 interface CompletionStage. 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
           .resetDefaultExecutor(executor2) // reset to use executor2
           .minimalCompletionStage();       // restrict to methods of CompletionStage
       

      CAUTION:
      if run on old Java 8(not support *minimal* CompletionStage), just return a Cffu with a *normal* underlying CompletableFuture which is NOT with a *minimal* CompletionStage.

    • resetDefaultExecutor

      @Contract(pure=true) public Cffu<T> resetDefaultExecutor(Executor defaultExecutor)
      Returns a new Cffu with the given defaultExecutor.

      demo code about re-config methods of Cffu:

      cffu2 = cffu
           .resetDefaultExecutor(executor2) // reset to use executor2
           .minimalCompletionStage();       // restrict to methods of CompletionStage
       
      See Also:
    • resetCffuFactory

      @Contract(pure=true) public Cffu<T> resetCffuFactory(CffuFactory cffuFactory)
      Returns a new Cffu with the given CffuFactory(contained configuration).

      demo code about re-config methods of Cffu:

      cffu2 = cffu
           .resetCffuFactory(cffuFactory2) // reset to use config from cffuFactory2
           .minimalCompletionStage();      // restrict to methods of CompletionStage
       
      Parameters:
      cffuFactory - cffuFactory contained configuration
      Returns:
      the new Cffu
      See Also:
    • toCompletableFuture

      @Contract(pure=true) public CompletableFuture<T> toCompletableFuture()
      Returns a CompletableFuture 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 method cffuUnwrap().

      Specified by:
      toCompletableFuture in interface CompletionStage<T>
      Returns:
      the CompletableFuture
      See Also:
    • copy

      @Contract(pure=true) public Cffu<T> 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 to thenApply(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.
      Returns:
      the new Cffu
    • defaultExecutor

      @Contract(pure=true) public Executor defaultExecutor()
      Returns the default Executor used for async methods that do not specify an Executor. Config from the CffuFactory.defaultExecutor(), and can re-configured by resetCffuFactory(CffuFactory).
      Returns:
      the default executor
      See Also:
    • cffuFactory

      @Contract(pure=true) public CffuFactory cffuFactory()
      Returns the CffuFactory of this Cffu. This can be re-configured by resetCffuFactory(CffuFactory).
      Returns:
      the CffuFactory
      See Also:
    • forbidObtrudeMethods

      @Contract(pure=true) public boolean forbidObtrudeMethods()
      Returns forbidObtrudeMethods or not. This can be re-configured by resetCffuFactory(CffuFactory).
      See Also:
    • isMinimalStage

      @Contract(pure=true) public boolean isMinimalStage()
      Returns whether is a minimal stage or not.

      create a minimal stage by below methods:

    • getNumberOfDependents

      @Contract(pure=true) public int 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

      public void obtrudeValue(@Nullable T value)
      Forcibly sets or resets the value subsequently returned by method get() 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

      public void obtrudeException(Throwable ex)
      Forcibly causes subsequent invocations of method get() 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

      @Contract(pure=true) public CompletableFuture<T> cffuUnwrap()
      Returns the underlying CompletableFuture. In general, you should NEVER use this method, use toCompletableFuture() instead.
      Returns:
      the underlying CompletableFuture
      See Also:
    • newIncompleteFuture

      @Contract(pure=true) public <U> Cffu<U> 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 to CompletableFuture, prefer CffuFactory.newIncompleteCffu().

      See Also:
    • toString

      @Contract(pure=true) public String 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.

      Overrides:
      toString in class Object
      Returns:
      a string identifying this Cffu, as well as its state
      See Also: