diff --git a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java index 68970380..bb38845a 100644 --- a/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java +++ b/cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java @@ -1566,7 +1566,7 @@ public static CompletableFuture> thenMApplyFastFailAsync( requireNonNull(executor, "executor is null"); requireArrayAndEleNonNull("fn", fns); - return toNonMinCf(cf).thenCompose(v -> allResultsOfFastFail(wrapFunctions(executor, v, fns))); + return f_toCf(cf).thenCompose(v -> allResultsOfFastFail(wrapFunctions(executor, v, fns))); } /** @@ -1620,7 +1620,7 @@ public static CompletableFuture> thenMApplyMostSuccessAsync( requireNonNull(unit, "unit is null"); requireArrayAndEleNonNull("fn", fns); - return toNonMinCf(cf).thenCompose(v -> mostResultsOfSuccess( + return f_toCf(cf).thenCompose(v -> mostResultsOfSuccess( valueIfNotSuccess, executor, timeout, unit, wrapFunctions(executor, v, fns) )); } @@ -1659,7 +1659,7 @@ public static CompletableFuture> thenMApplyAsync( requireNonNull(executor, "executor is null"); requireArrayAndEleNonNull("fn", fns); - return toNonMinCf(cf).thenCompose(v -> allResultsOf(wrapFunctions(executor, v, fns))); + return f_toCf(cf).thenCompose(v -> allResultsOf(wrapFunctions(executor, v, fns))); } private static CompletableFuture[] wrapFunctions( @@ -1701,7 +1701,7 @@ public static CompletableFuture thenMAcceptAsync( requireNonNull(executor, "executor is null"); requireArrayAndEleNonNull("action", actions); - return toNonMinCf(cf).thenCompose(v -> CompletableFuture.allOf(wrapConsumers(executor, v, actions))); + return f_toCf(cf).thenCompose(v -> CompletableFuture.allOf(wrapConsumers(executor, v, actions))); } /** @@ -1738,7 +1738,7 @@ public static CompletableFuture thenMAcceptFastFailAsync( requireNonNull(executor, "executor is null"); requireArrayAndEleNonNull("action", actions); - return toNonMinCf(cf).thenCompose(v -> allOfFastFail(wrapConsumers(executor, v, actions))); + return f_toCf(cf).thenCompose(v -> allOfFastFail(wrapConsumers(executor, v, actions))); } private static CompletableFuture[] wrapConsumers(Executor executor, T v, Consumer[] actions) { @@ -1785,37 +1785,37 @@ public static CompletableFuture thenMRunFastFailAsync( requireNonNull(executor, "executor is null"); requireArrayAndEleNonNull("action", actions); - return toNonMinCf(cf).thenCompose(unused -> allOfFastFail(wrapRunnables(executor, actions))); + return f_toCf(cf).thenCompose(unused -> allOfFastFail(wrapRunnables(executor, actions))); } /** * Returns a new CompletableFuture that, when the given stage completes normally, - * executes the given actions using the given Executor. + * executes the given actions using the CompletableFuture's default asynchronous execution facility. * * @param actions the actions to perform before completing the returned CompletableFuture * @return the new CompletableFuture - * @see CompletableFuture#thenRunAsync(Runnable, Executor) + * @see CompletableFuture#thenRunAsync(Runnable) * @see #allOf(CompletionStage[]) */ - public static CompletableFuture thenMRunAsync(CompletionStage cf, Executor executor, Runnable... actions) { - requireNonNull(cf, "cf is null"); - requireNonNull(executor, "executor is null"); - requireArrayAndEleNonNull("action", actions); - - return toNonMinCf(cf).thenCompose(unused -> CompletableFuture.allOf(wrapRunnables(executor, actions))); + public static CompletableFuture thenMRunAsync(CompletionStage cf, Runnable... actions) { + return thenMRunAsync(cf, AsyncPoolHolder.ASYNC_POOL, actions); } /** * Returns a new CompletableFuture that, when the given stage completes normally, - * executes the given actions using the CompletableFuture's default asynchronous execution facility. + * executes the given actions using the given Executor. * * @param actions the actions to perform before completing the returned CompletableFuture * @return the new CompletableFuture - * @see CompletableFuture#thenRunAsync(Runnable) + * @see CompletableFuture#thenRunAsync(Runnable, Executor) * @see #allOf(CompletionStage[]) */ - public static CompletableFuture thenMRunAsync(CompletionStage cf, Runnable... actions) { - return thenMRunAsync(cf, AsyncPoolHolder.ASYNC_POOL, actions); + public static CompletableFuture thenMRunAsync(CompletionStage cf, Executor executor, Runnable... actions) { + requireNonNull(cf, "cf is null"); + requireNonNull(executor, "executor is null"); + requireArrayAndEleNonNull("action", actions); + + return f_toCf(cf).thenCompose(unused -> CompletableFuture.allOf(wrapRunnables(executor, actions))); } // endregion