diff --git a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java index 7ca3345c..b79ba458 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/Cffu.java +++ b/cffu-core/src/main/java/io/foldright/cffu/Cffu.java @@ -217,8 +217,7 @@ public Cffu thenRunAsync(Runnable action, Executor executor) { //////////////////////////////////////////////////////////// /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -230,12 +229,27 @@ public Cffu thenRunAsync(Runnable action, Executor executor) { */ public Cffu> thenTupleMApplyFastFailAsync( Function fn1, Function fn2) { - return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, fn1, fn2)); + return thenTupleMApplyFastFailAsync(fac.defaultExecutor(), fn1, fn2); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * 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. + *

+ * This method is the same as {@link #thenTupleMApplyAsync(Executor, Function, Function)} + * except for the fast-fail behavior. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyFastFailAsync( + Executor executor, Function fn1, Function fn2) { + return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, executor, fn1, fn2)); + } + + /** + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -246,14 +260,30 @@ public Cffu> thenTupleMApplyFastFailAsync( * @return the new Cffu */ public Cffu> thenTupleMApplyFastFailAsync( - Function fn1, Function fn2, - Function fn3) { - return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, fn1, fn2, fn3)); + Function fn1, + Function fn2, Function fn3) { + return thenTupleMApplyFastFailAsync(fac.defaultExecutor(), fn1, fn2, fn3); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * 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. + *

+ * This method is the same as {@link #thenTupleMApplyAsync(Executor, Function, Function, Function)} + * except for the fast-fail behavior. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyFastFailAsync( + Executor executor, Function fn1, + Function fn2, Function fn3) { + return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, executor, fn1, fn2, fn3)); + } + + /** + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -266,12 +296,28 @@ public Cffu> thenTupleMApplyFastFailAsync( public Cffu> thenTupleMApplyFastFailAsync( Function fn1, Function fn2, Function fn3, Function fn4) { - return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, fn1, fn2, fn3, fn4)); + return thenTupleMApplyFastFailAsync(fac.defaultExecutor(), fn1, fn2, fn3, 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. + *

+ * This method is the same as {@link #thenTupleMApplyAsync(Executor, Function, Function, Function, Function)} + * except for the fast-fail behavior. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyFastFailAsync( + Executor executor, Function fn1, Function fn2, + Function fn3, Function fn4) { + return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, executor, fn1, fn2, fn3, fn4)); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -282,15 +328,32 @@ public Cffu> thenTupleMApplyFastFailAsyn * @return the new Cffu */ public Cffu> thenTupleMApplyFastFailAsync( - Function fn1, Function fn2, - Function fn3, Function fn4, - Function fn5) { - return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, fn1, fn2, fn3, fn4, fn5)); + Function fn1, + Function fn2, Function fn3, + Function fn4, Function fn5) { + return thenTupleMApplyFastFailAsync(fac.defaultExecutor(), fn1, fn2, fn3, fn4, 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. + *

+ * This method is the same as {@link #thenTupleMApplyAsync(Executor, Function, Function, Function, Function, Function)} + * except for the fast-fail behavior. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyFastFailAsync( + Executor executor, Function fn1, + Function fn2, Function fn3, + Function fn4, Function fn5) { + return reset0(CompletableFutureUtils.thenTupleMApplyFastFailAsync(cf, executor, fn1, fn2, fn3, fn4, fn5)); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -299,12 +362,24 @@ public Cffu> thenTupleMApplyFast */ public Cffu> thenTupleMApplyAsync( Function fn1, Function fn2) { - return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, fn1, fn2)); + return thenTupleMApplyAsync(fac.defaultExecutor(), fn1, fn2); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * 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. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyAsync( + Executor executor, Function fn1, Function fn2) { + return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, executor, fn1, fn2)); + } + + /** + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -314,12 +389,25 @@ public Cffu> thenTupleMApplyAsync( public Cffu> thenTupleMApplyAsync( Function fn1, Function fn2, Function fn3) { - return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, fn1, fn2, fn3)); + return thenTupleMApplyAsync(fac.defaultExecutor(), fn1, fn2, fn3); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * 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. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyAsync( + Executor executor, Function fn1, Function fn2, + Function fn3) { + return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, executor, fn1, fn2, fn3)); + } + + /** + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -329,12 +417,25 @@ public Cffu> thenTupleMApplyAsync( public Cffu> thenTupleMApplyAsync( Function fn1, Function fn2, Function fn3, Function fn4) { - return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, fn1, fn2, fn3, fn4)); + return thenTupleMApplyAsync(fac.defaultExecutor(), fn1, fn2, fn3, 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. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyAsync( + Executor executor, Function fn1, Function fn2, + Function fn3, Function fn4) { + return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, executor, fn1, fn2, fn3, fn4)); } /** - * Returns a new Cffu that, when this Cffu completes normally, - * is executed using the {@link #defaultExecutor()}, + * Returns a new Cffu that, when this Cffu completes normally, is executed using the {@link #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. @@ -345,7 +446,22 @@ public Cffu> thenTupleMApplyAsyn Function fn1, Function fn2, Function fn3, Function fn4, Function fn5) { - return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, fn1, fn2, fn3, fn4, fn5)); + return thenTupleMApplyAsync(fac.defaultExecutor(), fn1, fn2, fn3, fn4, 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. + * + * @return the new Cffu + */ + public Cffu> thenTupleMApplyAsync( + Executor executor, Function fn1, Function fn2, + Function fn3, Function fn4, + Function fn5) { + return reset0(CompletableFutureUtils.thenTupleMApplyAsync(cf, executor, fn1, fn2, fn3, fn4, fn5)); } // endregion