Skip to content

Commit

Permalink
WIP mostOf* using new orTimeout method
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed May 24, 2024
1 parent 9e68e0b commit 1650804
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ public static <T> CompletableFuture<List<T>> mostResultsOfSuccess(
// defensive copy input cf in order to
// avoid writing it by `completeOnTimeout` and read its result(`getSuccessNow`)
final CompletableFuture<T> f = toCfCopy(cfs[0]);
return orTimeout(f, timeout, unit)
return orTimeout(f, timeout, unit, AsyncPoolHolder.ASYNC_POOL)
.handle((unused, ex) -> arrayList(getSuccessNow(f, valueIfNotSuccess)));
}

// MUST be *Non-Minimal* CF instances in order to read results(`getSuccessNow`),
// otherwise UnsupportedOperationException
final CompletableFuture<T>[] cfArray = f_toNonMinCfArray(cfs);
return orTimeout(CompletableFuture.allOf(cfArray), timeout, unit)
return orTimeout(CompletableFuture.allOf(cfArray), timeout, unit, AsyncPoolHolder.ASYNC_POOL)
.handle((unused, ex) -> arrayList(MGetSuccessNow0(valueIfNotSuccess, cfArray)));
}

Expand Down Expand Up @@ -676,7 +676,7 @@ private static <T> CompletableFuture<T> mostTupleOfSuccess0(
// MUST be *Non-Minimal* CF instances in order to read results(`getSuccessNow`),
// otherwise UnsupportedOperationException
final CompletableFuture<Object>[] cfArray = f_toNonMinCfArray(css);
return orTimeout(CompletableFuture.allOf(cfArray), timeout, unit)
return orTimeout(CompletableFuture.allOf(cfArray), timeout, unit, AsyncPoolHolder.ASYNC_POOL)
.handle((unused, ex) -> tupleOf0(MGetSuccessNow0(null, cfArray)));
}

Expand Down

0 comments on commit 1650804

Please sign in to comment.