2401 |
|
* |
2402 |
|
* @param <U> the type of the value |
2403 |
|
* @return a new CompletableFuture |
2404 |
< |
* @since 1.9 |
2404 |
> |
* @since 9 |
2405 |
|
*/ |
2406 |
|
public <U> CompletableFuture<U> newIncompleteFuture() { |
2407 |
|
return new CompletableFuture<U>(); |
2416 |
|
* an Executor that provides at least one independent thread. |
2417 |
|
* |
2418 |
|
* @return the executor |
2419 |
< |
* @since 1.9 |
2419 |
> |
* @since 9 |
2420 |
|
*/ |
2421 |
|
public Executor defaultExecutor() { |
2422 |
|
return ASYNC_POOL; |
2434 |
|
* arrange dependent actions. |
2435 |
|
* |
2436 |
|
* @return the new CompletableFuture |
2437 |
< |
* @since 1.9 |
2437 |
> |
* @since 9 |
2438 |
|
*/ |
2439 |
|
public CompletableFuture<T> copy() { |
2440 |
|
return uniCopyStage(); |
2451 |
|
* cause. |
2452 |
|
* |
2453 |
|
* @return the new CompletionStage |
2454 |
< |
* @since 1.9 |
2454 |
> |
* @since 9 |
2455 |
|
*/ |
2456 |
|
public CompletionStage<T> minimalCompletionStage() { |
2457 |
|
return uniAsMinimalStage(); |
2466 |
|
* to complete this CompletableFuture |
2467 |
|
* @param executor the executor to use for asynchronous execution |
2468 |
|
* @return this CompletableFuture |
2469 |
< |
* @since 1.9 |
2469 |
> |
* @since 9 |
2470 |
|
*/ |
2471 |
|
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, |
2472 |
|
Executor executor) { |
2484 |
|
* @param supplier a function returning the value to be used |
2485 |
|
* to complete this CompletableFuture |
2486 |
|
* @return this CompletableFuture |
2487 |
< |
* @since 1.9 |
2487 |
> |
* @since 9 |
2488 |
|
*/ |
2489 |
|
public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) { |
2490 |
|
return completeAsync(supplier, defaultExecutor()); |
2500 |
|
* @param unit a {@code TimeUnit} determining how to interpret the |
2501 |
|
* {@code timeout} parameter |
2502 |
|
* @return this CompletableFuture |
2503 |
< |
* @since 1.9 |
2503 |
> |
* @since 9 |
2504 |
|
*/ |
2505 |
|
public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) { |
2506 |
|
if (unit == null) |
2521 |
|
* @param unit a {@code TimeUnit} determining how to interpret the |
2522 |
|
* {@code timeout} parameter |
2523 |
|
* @return this CompletableFuture |
2524 |
< |
* @since 1.9 |
2524 |
> |
* @since 9 |
2525 |
|
*/ |
2526 |
|
public CompletableFuture<T> completeOnTimeout(T value, long timeout, |
2527 |
|
TimeUnit unit) { |
2545 |
|
* {@code delay} parameter |
2546 |
|
* @param executor the base executor |
2547 |
|
* @return the new delayed executor |
2548 |
< |
* @since 1.9 |
2548 |
> |
* @since 9 |
2549 |
|
*/ |
2550 |
|
public static Executor delayedExecutor(long delay, TimeUnit unit, |
2551 |
|
Executor executor) { |
2564 |
|
* @param unit a {@code TimeUnit} determining how to interpret the |
2565 |
|
* {@code delay} parameter |
2566 |
|
* @return the new delayed executor |
2567 |
< |
* @since 1.9 |
2567 |
> |
* @since 9 |
2568 |
|
*/ |
2569 |
|
public static Executor delayedExecutor(long delay, TimeUnit unit) { |
2570 |
|
if (unit == null) |
2580 |
|
* @param value the value |
2581 |
|
* @param <U> the type of the value |
2582 |
|
* @return the completed CompletionStage |
2583 |
< |
* @since 1.9 |
2583 |
> |
* @since 9 |
2584 |
|
*/ |
2585 |
|
public static <U> CompletionStage<U> completedStage(U value) { |
2586 |
|
return new MinimalStage<U>((value == null) ? NIL : value); |
2593 |
|
* @param ex the exception |
2594 |
|
* @param <U> the type of the value |
2595 |
|
* @return the exceptionally completed CompletableFuture |
2596 |
< |
* @since 1.9 |
2596 |
> |
* @since 9 |
2597 |
|
*/ |
2598 |
|
public static <U> CompletableFuture<U> failedFuture(Throwable ex) { |
2599 |
|
if (ex == null) throw new NullPointerException(); |
2608 |
|
* @param ex the exception |
2609 |
|
* @param <U> the type of the value |
2610 |
|
* @return the exceptionally completed CompletionStage |
2611 |
< |
* @since 1.9 |
2611 |
> |
* @since 9 |
2612 |
|
*/ |
2613 |
|
public static <U> CompletionStage<U> failedStage(Throwable ex) { |
2614 |
|
if (ex == null) throw new NullPointerException(); |