93 |
|
* return myExecutor; } |
94 |
|
* public void obtrudeValue(T value) { |
95 |
|
* throw new UnsupportedOperationException(); } |
96 |
< |
* public void obtrudeException(Throwable ex) { |
96 |
> |
* public void obtrudeException(Throwable ex) { |
97 |
|
* throw new UnsupportedOperationException(); } |
98 |
|
* }}</pre> |
99 |
|
* |
1589 |
|
@SuppressWarnings("serial") |
1590 |
|
static final class AsyncSupply<T> extends ForkJoinTask<Void> |
1591 |
|
implements Runnable, AsynchronousCompletionTask { |
1592 |
< |
CompletableFuture<T> dep; Supplier<T> fn; |
1593 |
< |
AsyncSupply(CompletableFuture<T> dep, Supplier<T> fn) { |
1592 |
> |
CompletableFuture<T> dep; Supplier<? extends T> fn; |
1593 |
> |
AsyncSupply(CompletableFuture<T> dep, Supplier<? extends T> fn) { |
1594 |
|
this.dep = dep; this.fn = fn; |
1595 |
|
} |
1596 |
|
|
1599 |
|
public final boolean exec() { run(); return true; } |
1600 |
|
|
1601 |
|
public void run() { |
1602 |
< |
CompletableFuture<T> d; Supplier<T> f; |
1602 |
> |
CompletableFuture<T> d; Supplier<? extends T> f; |
1603 |
|
if ((d = dep) != null && (f = fn) != null) { |
1604 |
|
dep = null; fn = null; |
1605 |
|
if (d.result == null) { |
2460 |
|
* @return this CompletableFuture |
2461 |
|
* @since 1.9 |
2462 |
|
*/ |
2463 |
< |
public CompletableFuture<T> completeAsync(Supplier<T> supplier, |
2463 |
> |
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, |
2464 |
|
Executor executor) { |
2465 |
|
if (supplier == null || executor == null) |
2466 |
|
throw new NullPointerException(); |
2478 |
|
* @return this CompletableFuture |
2479 |
|
* @since 1.9 |
2480 |
|
*/ |
2481 |
< |
public CompletableFuture<T> completeAsync(Supplier<T> supplier) { |
2481 |
> |
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) { |
2482 |
|
return completeAsync(supplier, defaultExecutor()); |
2483 |
|
} |
2484 |
|
|