Package-level declarations

Functions

Link copied to clipboard

Returns a new CompletableFuture that, when either given stage success, is executed with the corresponding result as argument to the supplied action.

Link copied to clipboard

Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action.

Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied action.

Link copied to clipboard
fun Array<out Cffu<*>>.allFastFailOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<Void>
fun Collection<Cffu<*>>.allFastFailOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<Void>

Returns a new Cffu that is successful when all the given Cffus success, the results(Cffu<Void>) of the given Cffus are not reflected in the returned Cffu, but may be obtained by inspecting them individually. If any of the given Cffus complete exceptionally, then the returned Cffu also does so without waiting other incomplete given Cffus, with a CompletionException holding this exception as its cause. If no Cffus are provided, returns a Cffu completed with the value null.

@JvmName(name = "allFastFailOfCffuCs")
fun Collection<CompletionStage<*>>.allFastFailOfCffu(cffuFactory: CffuFactory): Cffu<Void>

Returns a new Cffu that is successful when all the given stages success, the results(Cffu<Void>) of the given stages are not reflected in the returned Cffu, but may be obtained by inspecting them individually. If any of the given stages complete exceptionally, then the returned Cffu also does so without waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value null.

Link copied to clipboard

Returns a new CompletableFuture that is successful when all the given CompletableFutures success, the results(CompletableFuture<Void>) of the given CompletableFutures are not reflected in the returned CompletableFuture, but may be obtained by inspecting them individually. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a CompletableFuture completed with the value null.

Link copied to clipboard
fun Array<out Cffu<*>>.allOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<Void>
fun Collection<Cffu<*>>.allOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<Void>

Returns a new Cffu that is completed when all the given Cffus complete. If any of the given Cffu complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. Otherwise, the results, if any, of the given Cffus are not reflected in the returned Cffu(Cffu<Void>), but may be obtained by inspecting them individually. If no Cffus are provided, returns a Cffu completed with the value null.

fun Array<out CompletionStage<*>>.allOfCffu(cffuFactory: CffuFactory): Cffu<Void>
@JvmName(name = "allOfCffuCs")
fun Collection<CompletionStage<*>>.allOfCffu(cffuFactory: CffuFactory): Cffu<Void>

Returns a new Cffu that is completed when all the given stages complete. If any of the given Cffu complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. Otherwise, the results, if any, of the given stages are not reflected in the returned Cffu(Cffu<Void>), but may be obtained by inspecting them individually. If no stages are provided, returns a Cffu completed with the value null.

Link copied to clipboard

Returns a new CompletableFuture that is completed when all the given stages complete. If any of the given stages complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause. Otherwise, the results, if any, of the given stages are not reflected in the returned CompletableFuture, but may be obtained by inspecting them individually. If no stages are provided, returns a CompletableFuture completed with the value null.

Link copied to clipboard
fun <T> Array<out Cffu<out T>>.allResultsFastFailOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>
fun <T> Collection<Cffu<out T>>.allResultsFastFailOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>

Returns a new Cffu with the results in the same order of the given Cffus arguments, the new Cffu success when all the given Cffus success. If any of the given Cffus complete exceptionally, then the returned Cffu also does so without waiting other incomplete given Cffus, with a CompletionException holding this exception as its cause. If no Cffus are provided, returns a Cffu completed with the value empty list.

@JvmName(name = "allResultsFastFailOfCffuCs")
fun <T> Collection<CompletionStage<out T>>.allResultsFastFailOfCffu(cffuFactory: CffuFactory): Cffu<List<T>>

Returns a new Cffu with the results in the same order of the given stages arguments, the new Cffu success when all the given stages success. If any of the given stages complete exceptionally, then the returned Cffu also does so without waiting other incomplete given stages, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value empty list.

Link copied to clipboard

Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures arguments, the new CompletableFuture success when all the given CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletableFutures, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a CompletableFuture completed with the value empty list.

Link copied to clipboard
fun <T> Array<out Cffu<out T>>.allResultsOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>
fun <T> Collection<Cffu<out T>>.allResultsOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>

Returns a new Cffu with the results in the same order of the given Cffus arguments, the new Cffu is completed when all the given Cffus complete. If any of the given Cffus complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no Cffus are provided, returns a Cffu completed with the value empty list.

fun <T> Array<out CompletionStage<out T>>.allResultsOfCffu(cffuFactory: CffuFactory): Cffu<List<T>>
@JvmName(name = "allResultsOfCffuCs")
fun <T> Collection<CompletionStage<out T>>.allResultsOfCffu(cffuFactory: CffuFactory): Cffu<List<T>>

Returns a new Cffu with the results in the same order of the given stages arguments, the new Cffu is completed when all the given stages complete. If any of the given stages complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no stages are provided, returns a Cffu completed with the value empty list.

Link copied to clipboard

Returns a new CompletableFuture with the results in the same order of all the given CompletableFutures arguments, the returned new CompletableFuture is completed when all the given CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a CompletableFuture completed with the value empty list.

Link copied to clipboard
fun <T> Array<out Cffu<out T>>.anyOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<T>
fun <T> Collection<Cffu<out T>>.anyOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<T>

Returns a new Cffu that is completed when any of the given Cffus complete, with the same result.

fun <T> Array<out CompletionStage<out T>>.anyOfCffu(cffuFactory: CffuFactory): Cffu<T>
@JvmName(name = "anyOfCffuCs")
fun <T> Collection<CompletionStage<out T>>.anyOfCffu(cffuFactory: CffuFactory): Cffu<T>

Returns a new Cffu that is completed when any of the given stages complete, with the same result.

Link copied to clipboard

Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result. Otherwise, if it completed exceptionally, the returned CompletableFuture also does so, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns an incomplete CompletableFuture.

Link copied to clipboard
fun <T> Array<out Cffu<out T>>.anySuccessOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<T>
fun <T> Collection<Cffu<out T>>.anySuccessOfCffu(cffuFactory: CffuFactory = ABSENT): Cffu<T>

Returns a new Cffu that is successful when any of the given Cffus success, with the same result. Otherwise, all the given Cffus complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of the given Cffus as its cause. If no Cffus are provided, returns a new Cffu that is already completed exceptionally with a CompletionException holding a NoCfsProvidedException as its cause.

fun <T> Array<out CompletionStage<out T>>.anySuccessOfCffu(cffuFactory: CffuFactory): Cffu<T>
@JvmName(name = "anySuccessOfCffuCs")
fun <T> Collection<CompletionStage<out T>>.anySuccessOfCffu(cffuFactory: CffuFactory): Cffu<T>

Returns a new Cffu that is successful when any of the given stages success, with the same result. Otherwise, all the given stages complete exceptionally, the returned Cffu also does so, with a CompletionException holding an exception from any of the given stages as its cause. If no stages are provided, returns a new Cffu that is already completed exceptionally with a CompletionException holding a NoCfsProvidedException as its cause.

Link copied to clipboard

Returns a new CompletableFuture that is successful when any of the given CompletableFutures success, with the same result. Otherwise, all the given CompletableFutures complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletableFutures as its cause. If no CompletableFutures are provided, returns a new CompletableFuture that is already completed exceptionally with a CompletionException holding a NoCfsProvidedException as its cause.

Link copied to clipboard

Returns a new CompletionStage that, when either given stage success, is executed with the corresponding result as argument to the supplied function.

Link copied to clipboard

Returns a new CompletionStage that, when either given stage success, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied function.

Returns a new CompletionStage that, when either given stage success, is executed using the supplied executor, with the corresponding result as argument to the supplied function.

Link copied to clipboard
fun <T, C : CompletableFuture<in T>> C.cffuCompleteOnTimeout(value: T, timeout: Long, unit: TimeUnit): C
fun <T, C : CompletableFuture<in T>> C.cffuCompleteOnTimeout(value: T, executorWhenTimeout: Executor, timeout: Long, unit: TimeUnit): C

Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.

Link copied to clipboard
fun <T, C : CompletableFuture<out T>> C.cffuOrTimeout(timeout: Long, unit: TimeUnit): C
fun <T, C : CompletableFuture<out T>> C.cffuOrTimeout(executorWhenTimeout: Executor, timeout: Long, unit: TimeUnit): C

Exceptionally completes this CompletableFuture with a TimeoutException if not otherwise completed before the given timeout.

Link copied to clipboard

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

Link copied to clipboard

Unwrap input Cffu array elements by Cffu.cffuUnwrap.

Unwrap input Cffu collection elements by Cffu.cffuUnwrap.

Link copied to clipboard
fun <T, C : CompletableFuture<in T>> C.completeAsync(supplier: Supplier<out T>): C

Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.

fun <T, C : CompletableFuture<in T>> C.completeAsync(supplier: Supplier<out T>, executor: Executor): C

Completes given CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.

Link copied to clipboard

If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the default executor.

If not already completed, completes given CompletableFuture with the exception result of the given Supplier function invoked from an asynchronous task using the given executor.

Link copied to clipboard
fun <T, C : CompletableFuture<in T>> C.completeOnTimeout(value: T, timeout: Long, unit: TimeUnit): C

Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.

Link copied to clipboard
operator fun <T1> Tuple2<T1, *>.component1(): T1
operator fun <T1> Tuple3<T1, *, *>.component1(): T1
operator fun <T1> Tuple4<T1, *, *, *>.component1(): T1
operator fun <T1> Tuple5<T1, *, *, *, *>.component1(): T1
Link copied to clipboard
operator fun <T2> Tuple2<*, T2>.component2(): T2
operator fun <T2> Tuple3<*, T2, *>.component2(): T2
operator fun <T2> Tuple4<*, T2, *, *>.component2(): T2
operator fun <T2> Tuple5<*, T2, *, *, *>.component2(): T2
Link copied to clipboard
operator fun <T3> Tuple3<*, *, T3>.component3(): T3
operator fun <T3> Tuple4<*, *, T3, *>.component3(): T3
operator fun <T3> Tuple5<*, *, T3, *, *>.component3(): T3
Link copied to clipboard
operator fun <T4> Tuple4<*, *, *, T4>.component4(): T4
operator fun <T4> Tuple5<*, *, *, T4, *>.component4(): T4
Link copied to clipboard
operator fun <T5> Tuple5<*, *, *, *, T5>.component5(): T5
Link copied to clipboard

Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally. If this CompletableFuture completes exceptionally, then the returned CompletableFuture completes exceptionally with a CompletionException with this exception as cause. The behavior is equivalent 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.

Link copied to clipboard

Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using given stage's default asynchronous execution facility. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.

fun <T, C : CompletionStage<in T>> C.exceptionallyAsync(fn: Function<Throwable, out T>, executor: Executor): C

Returns a new CompletionStage that, when given stage completes exceptionally, is executed with given stage's exception as the argument to the supplied function, using the supplied Executor. Otherwise, if given stage completes normally, then the returned stage also completes normally with the same value.

Link copied to clipboard

Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception.

Link copied to clipboard

Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using given stage's default asynchronous execution facility.

Returns a new CompletionStage that, when given stage completes exceptionally, is composed using the results of the supplied function applied to given stage's exception, using the supplied Executor.

Link copied to clipboard

Returns the exception thrown by the task, without waiting.

Link copied to clipboard
fun <T> CompletableFuture<T>.getSuccessNow(valueIfNotSuccess: T): T

Returns the result value if completed successfully, else returns the given valueIfNotSuccess.

Link copied to clipboard
fun <T> CompletableFuture<T>.join(timeout: Long, unit: TimeUnit): T

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.

Link copied to clipboard

Returns a new CompletionStage that is completed normally with the same value as given CompletableFuture when it completes normally, and cannot be independently completed or otherwise used in ways not defined by the methods of interface CompletionStage. If given CompletableFuture completes exceptionally, then the returned CompletionStage completes exceptionally with a CompletionException with given exception as cause.

Link copied to clipboard
fun <T> Array<out Cffu<out T>>.mostSuccessResultsOfCffu(valueIfNotSuccess: T, timeout: Long, unit: TimeUnit, cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>
fun <T> Collection<Cffu<out T>>.mostSuccessResultsOfCffu(valueIfNotSuccess: T, timeout: Long, unit: TimeUnit, cffuFactory: CffuFactory = ABSENT): Cffu<List<T>>

Returns a new Cffu with the most results in the same order of the given Cffus arguments in the given time(timeout, aka as many results as possible in the given time).

fun <T> Array<out CompletionStage<out T>>.mostSuccessResultsOfCffu(valueIfNotSuccess: T, timeout: Long, unit: TimeUnit, cffuFactory: CffuFactory): Cffu<List<T>>
@JvmName(name = "mostSuccessResultsOfCffuCs")
fun <T> Collection<CompletionStage<out T>>.mostSuccessResultsOfCffu(valueIfNotSuccess: T, timeout: Long, unit: TimeUnit, cffuFactory: CffuFactory): Cffu<List<T>>

Returns a new Cffu with the most results in the same order of the given stages arguments in the given time(timeout, aka as many results as possible in the given time).

Link copied to clipboard
fun <T> Array<out CompletionStage<out T>>.mostSuccessResultsOfCompletableFuture(valueIfNotSuccess: T, timeout: Long, unit: TimeUnit): CompletableFuture<List<T>>
fun <T> Array<out CompletionStage<out T>>.mostSuccessResultsOfCompletableFuture(valueIfNotSuccess: T, executorWhenTimeout: Executor, timeout: Long, unit: TimeUnit): CompletableFuture<List<T>>
fun <T> Collection<CompletionStage<out T>>.mostSuccessResultsOfCompletableFuture(valueIfNotSuccess: T, executorWhenTimeout: Executor, timeout: Long, unit: TimeUnit): CompletableFuture<List<T>>

Returns a new CompletableFuture with the most results in the same order of the given stages arguments in the given time(timeout, aka as many results as possible in the given time).

Link copied to clipboard

Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.

Link copied to clipboard
fun <T, C : CompletableFuture<out T>> C.orTimeout(timeout: Long, unit: TimeUnit): C

Exceptionally completes this CompletableFuture with a TimeoutException if not otherwise completed before the given timeout.

Link copied to clipboard
fun <T, C : CompletionStage<out T>> C.peek(action: BiConsumer<in T, in Throwable>): C

Peeks the result by executing the given action when this stage completes, returns this stage.

Link copied to clipboard
fun <T, C : CompletionStage<out T>> C.peekAsync(action: BiConsumer<in T, in Throwable>): C

Peeks the result by executing the given action when this stage completes, executes the given action using this stage's default asynchronous execution facility, returns this stage.

fun <T, C : CompletionStage<out T>> C.peekAsync(action: BiConsumer<in T, in Throwable>, executor: Executor): C

Peeks the result by executing the given action when this stage completes, executes the given action using the supplied Executor, returns this stage.

Link copied to clipboard
fun <T> Future<T>.resultNow(): T

Returns the computed result, without waiting.

Link copied to clipboard

Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using CompletableFuture's default asynchronous execution facility. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Returns a new CompletableFuture that, when two given stages both complete normally, executes the given action using the supplied executor. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when either given stage success, executes the given action. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when either given stage success, executes the given action using CompletableFuture's default asynchronous execution facility. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.

Returns a new CompletableFuture that, when either given stage success, executes the given action using the supplied executor. Otherwise, all two given CompletionStage complete exceptionally, the returned CompletableFuture also does so, with a CompletionException holding an exception from any of the given CompletionStage as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard
fun <T, U, V> CompletableFuture<out T>.thenCombineFastFail(other: CompletionStage<out U>, fn: BiFunction<in T, in U, out V>): CompletableFuture<V>

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using CompletableFuture's default asynchronous execution facility, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

fun <T, U, V> CompletableFuture<out T>.thenCombineFastFailAsync(other: CompletionStage<out U>, fn: BiFunction<in T, in U, out V>, executor: Executor): CompletableFuture<V>

Returns a new CompletableFuture that, when tow given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function. if any of the given stage complete exceptionally, then the returned CompletableFuture also does so without waiting other incomplete given CompletionStage, with a CompletionException holding this exception as its cause.

Link copied to clipboard
fun <T> CompletionStage<T>.toCffu(cffuFactory: CffuFactory): Cffu<T>

Wrap an existed CompletionStage (including CompletableFuture) to Cffu.

fun <T> Array<out CompletionStage<T>>.toCffu(cffuFactory: CffuFactory): Array<Cffu<T>>

Wrap input CompletionStage (including CompletableFuture) array elements to Cffu by CffuFactory.toCffu.

Wrap input CompletionStage (including CompletableFuture) collection elements to Cffu by CffuFactory.toCffu.

Link copied to clipboard