Skip to content

Commit

Permalink
调整方法顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
huhaosumail committed Jun 24, 2024
1 parent b682334 commit e06525c
Showing 1 changed file with 80 additions and 78 deletions.
158 changes: 80 additions & 78 deletions cffu-core/src/main/java/io/foldright/cffu/CompletableFutureUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,84 +133,6 @@ public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}

/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3> CompletableFuture<Tuple3<T1,T2,T3>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3,T4> CompletableFuture<Tuple4<T1,T2,T3,T4>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3,T4,T5> CompletableFuture<Tuple5<T1,T2,T3,T4,T5>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4,supplier5);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
Expand Down Expand Up @@ -640,6 +562,86 @@ public static <T1, T2, T3, T4, T5> CompletableFuture<Tuple5<T1, T2, T3, T4, T5>>
return allTupleOf0(false, wrapSuppliers(executor, suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2> CompletableFuture<Tuple2<T1,T2>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}

/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3> CompletableFuture<Tuple3<T1,T2,T3>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3,T4> CompletableFuture<Tuple4<T1,T2,T3,T4>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


/**
* Returns a new CompletableFuture that is asynchronously completed
* by tasks running in the given Executor with the values obtained by calling the given Suppliers
* in the <strong>same order</strong> of the given Suppliers arguments.
* <p>
* This method is the same as {@link #tupleMSupplyAsync(Executor, Supplier, Supplier,Supplier,Supplier,Supplier)} except for the most-success behavior.
*
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public static <T1,T2,T3,T4,T5> CompletableFuture<Tuple5<T1,T2,T3,T4,T5>> tupleMSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit, Supplier<? extends T1> supplier1, Supplier<? extends T2> supplier2, Supplier<? extends T3> supplier3, Supplier<? extends T4> supplier4, Supplier<? extends T5> supplier5) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
Supplier<?>[] suppliers = requireArrayAndEleNonNull("supplier", supplier1, supplier2,supplier3,supplier4,supplier5);

return mostTupleOfSuccess0(executor,timeout, unit, wrapSuppliers(executor,suppliers));
}


// endregion
////////////////////////////////////////////////////////////
// region## allOf* Methods(including mostResultsOfSuccess)
Expand Down

0 comments on commit e06525c

Please sign in to comment.