equal
deleted
inserted
replaced
2557 * CompletionStage}. If this CompletableFuture completes |
2557 * CompletionStage}. If this CompletableFuture completes |
2558 * exceptionally, then the returned CompletionStage completes |
2558 * exceptionally, then the returned CompletionStage completes |
2559 * exceptionally with a CompletionException with this exception as |
2559 * exceptionally with a CompletionException with this exception as |
2560 * cause. |
2560 * cause. |
2561 * |
2561 * |
|
2562 * <p>Unless overridden by a subclass, a new non-minimal |
|
2563 * CompletableFuture with all methods available can be obtained from |
|
2564 * a minimal CompletionStage via {@link #toCompletableFuture()}. |
|
2565 * For example, completion of a minimal stage can be awaited by |
|
2566 * |
|
2567 * <pre> {@code minimalStage.toCompletableFuture().join(); }</pre> |
|
2568 * |
2562 * @return the new CompletionStage |
2569 * @return the new CompletionStage |
2563 * @since 9 |
2570 * @since 9 |
2564 */ |
2571 */ |
2565 public CompletionStage<T> minimalCompletionStage() { |
2572 public CompletionStage<T> minimalCompletionStage() { |
2566 return uniAsMinimalStage(); |
2573 return uniAsMinimalStage(); |
2851 (long timeout, TimeUnit unit) { |
2858 (long timeout, TimeUnit unit) { |
2852 throw new UnsupportedOperationException(); } |
2859 throw new UnsupportedOperationException(); } |
2853 @Override public CompletableFuture<T> completeOnTimeout |
2860 @Override public CompletableFuture<T> completeOnTimeout |
2854 (T value, long timeout, TimeUnit unit) { |
2861 (T value, long timeout, TimeUnit unit) { |
2855 throw new UnsupportedOperationException(); } |
2862 throw new UnsupportedOperationException(); } |
|
2863 @Override public CompletableFuture<T> toCompletableFuture() { |
|
2864 Object r; |
|
2865 if ((r = result) != null) |
|
2866 return new CompletableFuture<T>(encodeRelay(r)); |
|
2867 else { |
|
2868 CompletableFuture<T> d = new CompletableFuture<>(); |
|
2869 unipush(new UniRelay<T,T>(d, this)); |
|
2870 return d; |
|
2871 } |
|
2872 } |
2856 } |
2873 } |
2857 |
2874 |
2858 // VarHandle mechanics |
2875 // VarHandle mechanics |
2859 private static final VarHandle RESULT; |
2876 private static final VarHandle RESULT; |
2860 private static final VarHandle STACK; |
2877 private static final VarHandle STACK; |