Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jun 16, 2024
1 parent 9b3c061 commit 106422e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public static <T> CompletableFuture<List<T>> mSupplyFastFailAsync(
@SafeVarargs
public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
@Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) {
return mSupplyMostSuccessAsync(AsyncPoolHolder.ASYNC_POOL, timeout, unit, valueIfNotSuccess, suppliers);
return mSupplyMostSuccessAsync(valueIfNotSuccess, AsyncPoolHolder.ASYNC_POOL, timeout, unit, suppliers);
}

/**
Expand All @@ -233,20 +233,20 @@ public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
* If the given supplier is successful in the given time, the return result is the completed value;
* Otherwise the given valueIfNotSuccess.
*
* @param <T> the suppliers' return type
* @param valueIfNotSuccess the value to return if not completed successfully
* @param executor the executor to use for asynchronous execution
* @param timeout how long to wait in units of {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the {@code timeout} parameter
* @param valueIfNotSuccess the value to return if not completed successfully
* @param suppliers the suppliers returning the value to be used to complete the returned CompletableFuture
* @param <T> the suppliers' return type
* @return the new CompletableFuture
* @see #mostResultsOfSuccess(Executor, long, TimeUnit, Object, CompletionStage[])
* @see CompletableFuture#supplyAsync(Supplier, Executor)
*/
@SafeVarargs
public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
Executor executor, long timeout, TimeUnit unit,
@Nullable T valueIfNotSuccess, Supplier<? extends T>... suppliers) {
@Nullable T valueIfNotSuccess, Executor executor, long timeout, TimeUnit unit,
Supplier<? extends T>... suppliers) {
requireNonNull(executor, "executor is null");
requireNonNull(unit, "unit is null");
requireArrayAndEleNonNull("supplier", suppliers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void test_mSupply() throws Exception {
mSupplyFastFailAsync(supplier, supplier),
mSupplyFastFailAsync(executorService, supplier, supplier),
mSupplyMostSuccessAsync(anotherN, 500, TimeUnit.MILLISECONDS, supplier, supplier),
mSupplyMostSuccessAsync(executorService, 500, TimeUnit.MILLISECONDS, anotherN, supplier, supplier),
mSupplyMostSuccessAsync(anotherN, executorService, 500, TimeUnit.MILLISECONDS, supplier, supplier),
};

assertTrue(System.currentTimeMillis() - tick < 50);
Expand Down

0 comments on commit 106422e

Please sign in to comment.