5 |
|
*/ |
6 |
|
|
7 |
|
package jsr166e; |
8 |
+ |
|
9 |
|
import java.util.concurrent.Future; |
10 |
|
import java.util.concurrent.FutureTask; |
11 |
|
import java.util.concurrent.TimeUnit; |
1391 |
|
* |
1392 |
|
* @param supplier a function returning the value to be used |
1393 |
|
* to complete the returned CompletableFuture |
1394 |
+ |
* @param <U> the function's return type |
1395 |
|
* @return the new CompletableFuture |
1396 |
|
*/ |
1397 |
|
public static <U> CompletableFuture<U> supplyAsync(Generator<U> supplier) { |
1410 |
|
* @param supplier a function returning the value to be used |
1411 |
|
* to complete the returned CompletableFuture |
1412 |
|
* @param executor the executor to use for asynchronous execution |
1413 |
+ |
* @param <U> the function's return type |
1414 |
|
* @return the new CompletableFuture |
1415 |
|
*/ |
1416 |
|
public static <U> CompletableFuture<U> supplyAsync(Generator<U> supplier, |
1463 |
|
* the given value. |
1464 |
|
* |
1465 |
|
* @param value the value |
1466 |
+ |
* @param <U> the type of the value |
1467 |
|
* @return the completed CompletableFuture |
1468 |
|
*/ |
1469 |
|
public static <U> CompletableFuture<U> completedFuture(U value) { |
2831 |
|
} |
2832 |
|
if (dst == null) |
2833 |
|
dst = new CompletableFuture<U>(); |
2834 |
< |
if (e == null || ex != null) |
2834 |
> |
if (ex != null) |
2835 |
|
dst.internalComplete(null, ex); |
2836 |
|
} |
2837 |
|
helpPostComplete(); |