9 |
|
import java.util.concurrent.FutureTask; |
10 |
|
import java.util.concurrent.TimeUnit; |
11 |
|
import java.util.concurrent.Executor; |
12 |
– |
import java.util.concurrent.ThreadLocalRandom; |
12 |
|
import java.util.concurrent.ExecutionException; |
13 |
|
import java.util.concurrent.TimeoutException; |
14 |
|
import java.util.concurrent.CancellationException; |
1390 |
|
* |
1391 |
|
* @param supplier a function returning the value to be used |
1392 |
|
* to complete the returned CompletableFuture |
1393 |
+ |
* @param <U> the function's return type |
1394 |
|
* @return the new CompletableFuture |
1395 |
|
*/ |
1396 |
|
public static <U> CompletableFuture<U> supplyAsync(Generator<U> supplier) { |
1409 |
|
* @param supplier a function returning the value to be used |
1410 |
|
* to complete the returned CompletableFuture |
1411 |
|
* @param executor the executor to use for asynchronous execution |
1412 |
+ |
* @param <U> the function's return type |
1413 |
|
* @return the new CompletableFuture |
1414 |
|
*/ |
1415 |
|
public static <U> CompletableFuture<U> supplyAsync(Generator<U> supplier, |
1462 |
|
* the given value. |
1463 |
|
* |
1464 |
|
* @param value the value |
1465 |
+ |
* @param <U> the type of the value |
1466 |
|
* @return the completed CompletableFuture |
1467 |
|
*/ |
1468 |
|
public static <U> CompletableFuture<U> completedFuture(U value) { |
2830 |
|
} |
2831 |
|
if (dst == null) |
2832 |
|
dst = new CompletableFuture<U>(); |
2833 |
< |
if (e == null || ex != null) |
2833 |
> |
if (ex != null) |
2834 |
|
dst.internalComplete(null, ex); |
2835 |
|
} |
2836 |
|
helpPostComplete(); |