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 88b9425 commit 9b3c061
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@ public static <T> CompletableFuture<List<T>> mSupplyFastFailAsync(
* 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 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(long, TimeUnit, Object, CompletionStage[])
* @see CompletableFuture#supplyAsync(Supplier)
*/
@SafeVarargs
public static <T> CompletableFuture<List<T>> mSupplyMostSuccessAsync(
long timeout, TimeUnit unit, @Nullable T valueIfNotSuccess, Supplier<? extends T>... suppliers) {
@Nullable T valueIfNotSuccess, long timeout, TimeUnit unit, Supplier<? extends T>... suppliers) {
return mSupplyMostSuccessAsync(AsyncPoolHolder.ASYNC_POOL, timeout, unit, valueIfNotSuccess, suppliers);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void test_mSupply() throws Exception {
final long tick = System.currentTimeMillis();

@SuppressWarnings("unused")
final CompletableFuture<List<Object>> listCompletableFuture = mSupplyMostSuccessAsync(200, TimeUnit.MILLISECONDS, supplier, supplier);
final CompletableFuture<List<Object>> listCompletableFuture = mSupplyMostSuccessAsync(supplier, 200, TimeUnit.MILLISECONDS, supplier);
// FIXME unexpected type inference, move default value argument ahead before timeout???

@SuppressWarnings("unchecked")
Expand All @@ -74,7 +74,7 @@ void test_mSupply() throws Exception {
mSupplyAsync(executorService, supplier, supplier),
mSupplyFastFailAsync(supplier, supplier),
mSupplyFastFailAsync(executorService, supplier, supplier),
mSupplyMostSuccessAsync(500, TimeUnit.MILLISECONDS, anotherN, supplier, supplier),
mSupplyMostSuccessAsync(anotherN, 500, TimeUnit.MILLISECONDS, supplier, supplier),
mSupplyMostSuccessAsync(executorService, 500, TimeUnit.MILLISECONDS, anotherN, supplier, supplier),
};

Expand Down

0 comments on commit 9b3c061

Please sign in to comment.