Class CffuFactory
CffuFactory is equivalent to CompletableFuture,
contains the static factory methods of CompletableFuture.
The methods that equivalent to the instance methods of CompletableFuture is in Cffu class.
Use CffuFactoryBuilder to config and build CffuFactory.
About factory methods conventions of CffuFactory:
- factory methods return
Cffuinstead ofCompletableFuture. - new methods, aka. no equivalent method in
CompletableFuture, prefix method name withcffu. - only provide varargs methods for multiply Cffu/CF input arguments;
if you have
Listinput, use static util methodscffuListToArray(List)orcompletableFutureListToArray(List)to convert it to array first.
- Author:
- Jerry Lee (oldratlee at gmail dot com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionallOf()Provided this overloaded method just for resolving "allOf is ambiguous" problem when callallOfwith empty arguments:cffuFactory.allOf().Returns a new Cffu that is completed when all the given Cffus complete.allOf(CompletableFuture<?>... cfs) Returns a new Cffu that is completed when all the given CompletableFutures complete.Provided this overloaded method just for resolving "allOfFastFail is ambiguous" problem when callallOfFastFailwith empty arguments:cffuFactory.allOfFastFail().allOfFastFail(Cffu<?>... cfs) Returns a new Cffu that success 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.allOfFastFail(CompletableFuture<?>... cfs) Returns a new Cffu that success when all the given CompletableFutures success, the results(Cffu<Void>) of the given CompletableFutures are not reflected in the returned Cffu, but may be obtained by inspecting them individually.anyOf()Provided this overloaded method just for resolving "anyOf is ambiguous" problem when callanyOfwith empty arguments:cffuFactory.anyOf().Returns a new Cffu that is completed when any of the given Cffus complete, with the same result.
Otherwise, if it completed exceptionally, the returned Cffu also does so, with a CompletionException holding this exception as its cause.
If no Cffus are provided, returns an incomplete Cffu.anyOf(CompletableFuture<?>... cfs) Same asanyOf(Cffu[])with overloaded argument typeCompletableFuture.Provided this overloaded method just for resolving "cffuAnyOfSuccess is ambiguous" problem when callanyOfSuccesswith empty arguments:cffuFactory.anyOfSuccess().anyOfSuccess(Cffu<?>... cfs) Returns a new Cffu that success when any of the given Cffus success, with the same result.anyOfSuccess(CompletableFuture<?>... cfs) Returns a new Cffu that success when any of the given CompletableFutures success, with the same result.<T> Cffu<T>asCffu(CompletionStage<T> stage) final <T> Cffu<T>[]asCffuArray(CompletionStage<T>... stages) A convenient util method for wrap inputCompletableFuture/CompletionStage/Cffuarray element byasCffu(CompletionStage).Provided this overloaded method just for resolving "cffuAllOf is ambiguous" problem when callcffuAllOfwith empty arguments:cffuFactory.cffuAllOf().Returns a new Cffu with the results of all the given Cffus, the new Cffu is completed when all the given Cffus complete.cffuAllOf(CompletableFuture<T>... cfs) Returns a new Cffu with the results of all the given CompletableFutures, the new Cffu is completed when all the given CompletableFutures complete.Provided this overloaded method just for resolving "cffuAllOfFastFail is ambiguous" problem when callcffuAllOfFastFailwith empty arguments:cffuFactory.cffuAllOfFastFail().cffuAllOfFastFail(Cffu<T>... cfs) Returns a new Cffu with the results of all the given Cffus, the new Cffu success when all the given Cffus success.cffuAllOfFastFail(CompletableFuture<T>... cfs) Returns a new Cffu with the results of all the given CompletableFutures, the new Cffu success when all the given CompletableFutures success.<T> Cffu<T>Provided this overloaded method just for resolving "cffuAnyOf is ambiguous" problem when callcffuAnyOfwith empty arguments:cffuFactory.cffuAnyOf().final <T> Cffu<T>Returns a new Cffu that is completed when any of the given Cffus complete, with the same result.final <T> Cffu<T>cffuAnyOf(CompletableFuture<T>... cfs) Returns a new Cffu that is completed when any of the given CompletableFutures complete, with the same result.<T> Cffu<T>Provided this overloaded method just for resolving "cffuAnyOfSuccess is ambiguous" problem when callcffuAnyOfSuccesswith empty arguments:cffuFactory.cffuAnyOfSuccess().final <T> Cffu<T>cffuAnyOfSuccess(Cffu<T>... cfs) Returns a new Cffu that success when any of the given Cffus success, with the same result.final <T> Cffu<T>cffuAnyOfSuccess(CompletableFuture<T>... cfs) Returns a new Cffu that success when any of the given CompletableFutures success, with the same result.static <T> CompletableFuture<T>[]cffuArrayUnwrap(Cffu<T>... cfs) A convenient util method for unwrap inputCffuarray elements byCffu.cffuUnwrap().cffuCombine(Cffu<T1> cf1, Cffu<T2> cf2) Returns a new Cffu that is completed when the given two Cffus complete.cffuCombine(Cffu<T1> cf1, Cffu<T2> cf2, Cffu<T3> cf3) Returns a new Cffu that is completed when the given three Cffus complete.cffuCombine(Cffu<T1> cf1, Cffu<T2> cf2, Cffu<T3> cf3, Cffu<T4> cf4) Returns a new Cffu that is completed when the given 4 Cffus complete.Returns a new Cffu that is completed when the given 5 Cffus complete.cffuCombine(CompletableFuture<T1> cf1, CompletableFuture<T2> cf2) Returns a new Cffu that is completed when the given two CompletableFutures complete.cffuCombine(CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3) Returns a new Cffu that is completed when the given three CompletableFutures complete.cffuCombine(CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3, CompletableFuture<T4> cf4) Returns a new Cffu that is completed when the given 4 CompletableFutures complete.cffuCombine(CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3, CompletableFuture<T4> cf4, CompletableFuture<T5> cf5) Returns a new Cffu that is completed when the given 5 CompletableFutures complete.static <T> Cffu<T>[]cffuListToArray(List<Cffu<T>> cffuList) Convert Cffu list to Cffu array.static <T> CompletableFuture<T>[]completableFutureListToArray(List<CompletableFuture<T>> cfList) Convert CompletableFuture list to CompletableFuture array.<T> Cffu<T>completedFuture(T value) Returns a new Cffu that is already completed with the given value.<T> CompletionStage<T>completedStage(T value) Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.ReturnsdefaultExecutor.delayedExecutor(long delay, TimeUnit unit) Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive).delayedExecutor(long delay, TimeUnit unit, Executor executor) Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive).<T> Cffu<T>Returns a new Cffu that is already completed exceptionally with the given exception.<T> CompletionStage<T>failedStage(Throwable ex) Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.booleanReturnsforbidObtrudeMethodsor not.<T> Cffu<T>Return an incomplete Cffu, equivalent toCompletableFuture()constructor.Returns a new Cffu that is asynchronously completed by a task running in thedefaultExecutor()after it runs the given action.Returns a new Cffu that is asynchronously completed by a task running in the given executor after it runs the given action.<T> Cffu<T>supplyAsync(Supplier<T> supplier) Returns a new Cffu that is asynchronously completed by a task running in thedefaultExecutor()with the value obtained by calling the given Supplier.<T> Cffu<T>supplyAsync(Supplier<T> supplier, Executor executor) Returns a new Cffu that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier.static <T> CompletableFuture<T>[]toCompletableFutureArray(CompletionStage<T>... stages) A convenient util method for converting inputCffu/CompletableFuture/CompletionStagearray element byCffu.toCompletableFuture()/CompletableFuture.toCompletableFuture()/CompletionStage.toCompletableFuture().
-
Method Details
-
completedFuture
Returns a new Cffu that is already completed with the given value.- Type Parameters:
T- the type of the value- Parameters:
value- the value- Returns:
- the completed Cffu
- See Also:
-
completedStage
Returns a new CompletionStage that is already completed with the given value and supports only those methods in interfaceCompletionStage.CAUTION:
if run on old Java 8, just return a Cffu with a *normal* underneath CompletableFuture which is NOT with a *minimal* CompletionStage.- Type Parameters:
T- the type of the value- Parameters:
value- the value- Returns:
- the completed CompletionStage
- See Also:
-
failedFuture
Returns a new Cffu that is already completed exceptionally with the given exception.- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed Cffu
- See Also:
-
failedStage
Returns a new CompletionStage that is already completed exceptionally with the given exception and supports only those methods in interfaceCompletionStage.CAUTION:
if run on old Java 8, just return a Cffu with a *normal* underneath CompletableFuture which is NOT with a *minimal* CompletionStage.- Type Parameters:
T- the type of the value- Parameters:
ex- the exception- Returns:
- the exceptionally completed CompletionStage
- See Also:
-
runAsync
Returns a new Cffu that is asynchronously completed by a task running in thedefaultExecutor()after it runs the given action.- Parameters:
action- the action to run before completing the returned Cffu- Returns:
- the new Cffu
- See Also:
-
runAsync
Returns a new Cffu that is asynchronously completed by a task running in the given executor after it runs the given action.- Parameters:
action- the action to run before completing the returned Cffuexecutor- the executor to use for asynchronous execution- Returns:
- the new Cffu
- See Also:
-
supplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `runAsync`") public <T> Cffu<T> supplyAsync(Supplier<T> supplier) Returns a new Cffu that is asynchronously completed by a task running in thedefaultExecutor()with the value obtained by calling the given Supplier.- Type Parameters:
T- the function's return type- Parameters:
supplier- a function returning the value to be used to complete the returned Cffu- Returns:
- the new Cffu
- See Also:
-
supplyAsync
@CheckReturnValue(explanation="should use the returned Cffu; otherwise, prefer method `runAsync`") public <T> Cffu<T> supplyAsync(Supplier<T> supplier, Executor executor) Returns a new Cffu that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier.- Type Parameters:
T- the function's return type- Parameters:
supplier- a function returning the value to be used to complete the returned Cffuexecutor- the executor to use for asynchronous execution- Returns:
- the new Cffu
- See Also:
-
newIncompleteCffu
Return an incomplete Cffu, equivalent toCompletableFuture()constructor.In general, should not use this method in biz code, prefer below factory methods of Cffu:
-
asCffu
Wrap an existedCompletableFuture/CompletionStage/CffutoCffu. forCompletableFutureclass instances,Cffu.cffuUnwrap()is the inverse operation to this method.NOTE, keep input stage unchanged if possible when wrap:
- if input stage is a
Cffu, re-wrapped with the config of thisCffuFactoryfromCffuFactoryBuilderbyCffu.resetCffuFactory(CffuFactory). - if input stage is a CompletableFuture, wrap it by setting it as the underneath cf of returned cffu.
- otherwise use input
stage.toCompletableFutureas the underneath cf of returned cffu.
- if input stage is a
-
asCffuArray
@Contract(pure=true) @SafeVarargs public final <T> Cffu<T>[] asCffuArray(CompletionStage<T>... stages) A convenient util method for wrap inputCompletableFuture/CompletionStage/Cffuarray element byasCffu(CompletionStage).- See Also:
-
allOf
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 valuenull.if you need the results of given Cffus, prefer below methods:
cffuAllOf(Cffu[])cffuCombine(Cffu, Cffu)/cffuCombine(Cffu, Cffu, Cffu, Cffu, Cffu)(provided overloaded methods with 2~5 input)
Among the applications of this method is to await completion of a set of independent Cffus before continuing a program, as in:
CffuFactory.allOf(c1, c2, c3).join();.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu that is completed when all the given Cffus complete
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allOf
Returns a new Cffu that is completed when all the given CompletableFutures complete. If any of the given CompletableFuture 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 CompletableFutures are not reflected in the returned Cffu(Cffu<Void>), but may be obtained by inspecting them individually.
If no CompletableFutures are provided, returns a Cffu completed with the valuenull.Same as
allOf(Cffu[])with overloaded argument typeCompletableFuture.if you need the results of given CompletableFutures, prefer below methods:
cffuAllOf(CompletableFuture[])cffuCombine(CompletableFuture, CompletableFuture)/cffuCombine(CompletableFuture, CompletableFuture, CompletableFuture, CompletableFuture, CompletableFuture)(provided overloaded methods with 2~5 input)
- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu that is completed when all the given CompletableFutures complete
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allOf(Cffu[])cffuAllOf(CompletableFuture[])cffuCombine(CompletableFuture, CompletableFuture)cffuCombine(CompletableFuture, CompletableFuture, CompletableFuture)cffuCombine(CompletableFuture, CompletableFuture, CompletableFuture, CompletableFuture)cffuCombine(CompletableFuture, CompletableFuture, CompletableFuture, CompletableFuture, CompletableFuture)CompletableFuture.allOf(CompletableFuture[])
-
allOf
Provided this overloaded method just for resolving "allOf is ambiguous" problem when callallOfwith empty arguments:cffuFactory.allOf().- See Also:
-
allOfFastFail
Returns a new Cffu that success 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 valuenull.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu that success when all the given Cffus success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allOfFastFail
Returns a new Cffu that success when all the given CompletableFutures success, the results(Cffu<Void>) of the given CompletableFutures are not reflected in the returned Cffu, but may be obtained by inspecting them individually. If any of the given CompletableFutures complete exceptionally, then the returned Cffu 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 Cffu completed with the valuenull.Same as
allOfFastFail(Cffu[])with overloaded argument typeCompletableFuture.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu that success when all the given CompletableFutures success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
allOfFastFail
Provided this overloaded method just for resolving "allOfFastFail is ambiguous" problem when callallOfFastFailwith empty arguments:cffuFactory.allOfFastFail(). -
anyOf
Returns a new Cffu that is completed when any of the given Cffus complete, with the same result.
Otherwise, if it completed exceptionally, the returned Cffu also does so, with a CompletionException holding this exception as its cause.
If no Cffus are provided, returns an incomplete Cffu.prefer
cffuAnyOf(Cffu[])method if the given Cffus have same result type, becausecffuAnyOf(Cffu[])return typeTinstead of typeObject, more type safe.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu that is completed with the result or exception from any of the given Cffus when one completes
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOf
Same asanyOf(Cffu[])with overloaded argument typeCompletableFuture.prefer
cffuAnyOf(CompletableFuture[])method if the given Cffus have same result type, becausecffuAnyOf(CompletableFuture[])return typeTinstead of typeObject, more type safe.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu that is completed with the result or exception from any of the given CompletableFutures when one completes
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOf
Provided this overloaded method just for resolving "anyOf is ambiguous" problem when callanyOfwith empty arguments:cffuFactory.anyOf().- See Also:
-
anyOfSuccess
Returns a new Cffu that success 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 Cffu as its cause. If no Cffu are provided, returns a new Cffu that is already completed exceptionally with a CompletionException holding aNoCfsProvidedExceptionas its cause.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOfSuccess
Returns a new Cffu that success when any of the given CompletableFutures success, with the same result. Otherwise, all the given CompletableFutures complete exceptionally, the returned Cffu 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 Cffu that is already completed exceptionally with a CompletionException holding aNoCfsProvidedExceptionas its cause.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
anyOfSuccess
Provided this overloaded method just for resolving "cffuAnyOfSuccess is ambiguous" problem when callanyOfSuccesswith empty arguments:cffuFactory.anyOfSuccess(). -
delayedExecutor
Returns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameter- Returns:
- the new delayed executor
-
delayedExecutor
Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). Each delay commences upon invocation of the returned executor'sexecutemethod.- Parameters:
delay- how long to delay, in units ofunitunit- aTimeUnitdetermining how to interpret thedelayparameterexecutor- the base executor- Returns:
- the new delayed executor
-
cffuAllOf
Returns a new Cffu with the results of all the given Cffus, the new Cffu is completed when all the given Cffus complete. Returns a new Cffu that 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 valueemptyList.Same to
allOf(Cffu[]), but the returned Cffu contains the results of input Cffus.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu that is completed when all the given Cffus complete
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAllOf
@Contract(pure=true) @SafeVarargs public final <T> Cffu<List<T>> cffuAllOf(CompletableFuture<T>... cfs) Returns a new Cffu with the results of all the given CompletableFutures, the new Cffu is completed when all the given CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause. If no CompletableFutures are provided, returns a Cffu completed with the valueemptyList.Same as
cffuAllOf(Cffu[])with overloaded argument typeCompletableFuture.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu that is completed when all the given CompletableFutures complete
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAllOf
Provided this overloaded method just for resolving "cffuAllOf is ambiguous" problem when callcffuAllOfwith empty arguments:cffuFactory.cffuAllOf(). -
cffuAllOfFastFail
Returns a new Cffu with the results of all the given Cffus, 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 CompletableFutures are provided, returns a Cffu completed with the valueemptyList.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that success when all the given CompletableFutures success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAllOfFastFail
@Contract(pure=true) @SafeVarargs public final <T> Cffu<List<T>> cffuAllOfFastFail(CompletableFuture<T>... cfs) Returns a new Cffu with the results of all the given CompletableFutures, the new Cffu success when all the given CompletableFutures success. If any of the given CompletableFutures complete exceptionally, then the returned Cffu 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 Cffu completed with the valueemptyList.Same as
cffuAllOfFastFail(Cffu[])with overloaded argument typeCompletableFuture.- Parameters:
cfs- the CompletableFutures- Returns:
- a new CompletableFuture that success when all the given CompletableFutures success
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAllOfFastFail
Provided this overloaded method just for resolving "cffuAllOfFastFail is ambiguous" problem when callcffuAllOfFastFailwith empty arguments:cffuFactory.cffuAllOfFastFail(). -
cffuAnyOf
Returns a new Cffu that is completed when any of the given Cffus complete, with the same result.Same as
anyOf(Cffu[]), but return result type is specified type instead of typeObject.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu that is completed with the result or exception from any of the given Cffus when one completes
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAnyOf
Returns a new Cffu that is completed when any of the given CompletableFutures complete, with the same result.Same as
cffuAllOf(Cffu[])with overloaded argument typeCompletableFuture.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu that is completed with the result or exception from any of the given CompletableFutures when one completes
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAnyOf
Provided this overloaded method just for resolving "cffuAnyOf is ambiguous" problem when callcffuAnyOfwith empty arguments:cffuFactory.cffuAnyOf(). -
cffuAnyOfSuccess
Returns a new Cffu that success 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 Cffu as its cause. If no Cffu are provided, returns a new Cffu that is already completed exceptionally with a CompletionException holding aNoCfsProvidedExceptionas its cause.- Parameters:
cfs- the Cffus- Returns:
- a new Cffu
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAnyOfSuccess
Returns a new Cffu that success when any of the given CompletableFutures success, with the same result. Otherwise, all the given CompletableFutures complete exceptionally, the returned Cffu 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 Cffu that is already completed exceptionally with a CompletionException holding aNoCfsProvidedExceptionas its cause.Same as
cffuAnyOfSuccess(Cffu[])with overloaded argument typeCompletableFuture.- Parameters:
cfs- the CompletableFutures- Returns:
- a new Cffu
- Throws:
NullPointerException- if the array or any of its elements arenull- See Also:
-
cffuAnyOfSuccess
Provided this overloaded method just for resolving "cffuAnyOfSuccess is ambiguous" problem when callcffuAnyOfSuccesswith empty arguments:cffuFactory.cffuAnyOfSuccess(). -
cffuCombine
Returns a new Cffu that is completed when the given two 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.Same as
cffuAllOf(Cffu[])but with two inputs and return results asTuple2.- Returns:
- a new Cffu that is completed when the given two Cffus complete
- Throws:
NullPointerException- if any input Cffus arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2> Cffu<Tuple2<T1,T2>> cffuCombine(CompletableFuture<T1> cf1, CompletableFuture<T2> cf2) Returns a new Cffu that is completed when the given two CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause.Same as
cffuCombine(Cffu, Cffu)with overloaded argument typeCompletableFuture.- Returns:
- a new Cffu that is completed when the given 2 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple3<T1,T3> T2, cffuCombineT3>> (Cffu<T1> cf1, Cffu<T2> cf2, Cffu<T3> cf3) Returns a new Cffu that is completed when the given three 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.Same as
cffuAllOf(Cffu[])but with three inputs and return results asTuple3.- Returns:
- a new Cffu that is completed when the given three Cffus complete
- Throws:
NullPointerException- if any input Cffus arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple3<T1,T3> T2, cffuCombineT3>> (CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3) Returns a new Cffu that is completed when the given three CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause.Same as
cffuCombine(Cffu, Cffu, Cffu)with overloaded argument typeCompletableFuture.- Returns:
- a new Cffu that is completed when the given 3 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple4<T1,T3, T4> T2, cffuCombineT3, T4>> (Cffu<T1> cf1, Cffu<T2> cf2, Cffu<T3> cf3, Cffu<T4> cf4) Returns a new Cffu that is completed when the given 4 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.Same as
cffuAllOf(Cffu[])but with 4 inputs and return results asTuple4.- Returns:
- a new Cffu that is completed when the given 4 Cffus complete
- Throws:
NullPointerException- if any input Cffus arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple4<T1,T3, T4> T2, cffuCombineT3, T4>> (CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3, CompletableFuture<T4> cf4) Returns a new Cffu that is completed when the given 4 CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause.Same as
cffuCombine(Cffu, Cffu, Cffu, Cffu)with overloaded argument typeCompletableFuture.- Returns:
- a new Cffu that is completed when the given 4 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple5<T1,T3, T4, T5> T2, cffuCombineT3, T4, T5>> (Cffu<T1> cf1, Cffu<T2> cf2, Cffu<T3> cf3, Cffu<T4> cf4, Cffu<T5> cf5) Returns a new Cffu that is completed when the given 5 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.Same as
cffuAllOf(Cffu[])but with 5 inputs and return results asTuple5.- Returns:
- a new Cffu that is completed when the given 5 Cffus complete
- Throws:
NullPointerException- if any input Cffus arenull- See Also:
-
cffuCombine
@Contract(pure=true) public <T1,T2, Cffu<Tuple5<T1,T3, T4, T5> T2, cffuCombineT3, T4, T5>> (CompletableFuture<T1> cf1, CompletableFuture<T2> cf2, CompletableFuture<T3> cf3, CompletableFuture<T4> cf4, CompletableFuture<T5> cf5) Returns a new Cffu that is completed when the given 5 CompletableFutures complete. If any of the given CompletableFutures complete exceptionally, then the returned Cffu also does so, with a CompletionException holding this exception as its cause.Same as
cffuCombine(Cffu, Cffu, Cffu, Cffu, Cffu)with overloaded argument typeCompletableFuture.- Returns:
- a new Cffu that is completed when the given 5 CompletableFutures complete
- Throws:
NullPointerException- if any of the given CompletableFutures arenull- See Also:
-
toCompletableFutureArray
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T>[] toCompletableFutureArray(CompletionStage<T>... stages) A convenient util method for converting inputCffu/CompletableFuture/CompletionStagearray element byCffu.toCompletableFuture()/CompletableFuture.toCompletableFuture()/CompletionStage.toCompletableFuture(). -
cffuArrayUnwrap
@Contract(pure=true) @SafeVarargs public static <T> CompletableFuture<T>[] cffuArrayUnwrap(Cffu<T>... cfs) A convenient util method for unwrap inputCffuarray elements byCffu.cffuUnwrap().- Parameters:
cfs- the Cffus- See Also:
-
cffuListToArray
Convert Cffu list to Cffu array. -
completableFutureListToArray
@Contract(pure=true) public static <T> CompletableFuture<T>[] completableFutureListToArray(List<CompletableFuture<T>> cfList) Convert CompletableFuture list to CompletableFuture array. -
defaultExecutor
ReturnsdefaultExecutor.- Returns:
- the default executor
- See Also:
-
forbidObtrudeMethods
ReturnsforbidObtrudeMethodsor not.
-