< prev index next >

jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java

Print this page

        

*** 2427,2437 **** * class as this CompletableFuture. The default implementation * returns an instance of class CompletableFuture. * * @param <U> the type of the value * @return a new CompletableFuture ! * @since 1.9 */ public <U> CompletableFuture<U> newIncompleteFuture() { return new CompletableFuture<U>(); } --- 2427,2437 ---- * class as this CompletableFuture. The default implementation * returns an instance of class CompletableFuture. * * @param <U> the type of the value * @return a new CompletableFuture ! * @since 9 */ public <U> CompletableFuture<U> newIncompleteFuture() { return new CompletableFuture<U>(); }
*** 2442,2452 **** * parallel thread, or else an Executor using one thread per async * task. This method may be overridden in subclasses to return * an Executor that provides at least one independent thread. * * @return the executor ! * @since 1.9 */ public Executor defaultExecutor() { return ASYNC_POOL; } --- 2442,2452 ---- * parallel thread, or else an Executor using one thread per async * task. This method may be overridden in subclasses to return * an Executor that provides at least one independent thread. * * @return the executor ! * @since 9 */ public Executor defaultExecutor() { return ASYNC_POOL; }
*** 2460,2470 **** * method may be useful as a form of "defensive copying", to * prevent clients from completing, while still being able to * arrange dependent actions. * * @return the new CompletableFuture ! * @since 1.9 */ public CompletableFuture<T> copy() { return uniCopyStage(); } --- 2460,2470 ---- * method may be useful as a form of "defensive copying", to * prevent clients from completing, while still being able to * arrange dependent actions. * * @return the new CompletableFuture ! * @since 9 */ public CompletableFuture<T> copy() { return uniCopyStage(); }
*** 2477,2487 **** * exceptionally, then the returned CompletionStage completes * exceptionally with a CompletionException with this exception as * cause. * * @return the new CompletionStage ! * @since 1.9 */ public CompletionStage<T> minimalCompletionStage() { return uniAsMinimalStage(); } --- 2477,2487 ---- * exceptionally, then the returned CompletionStage completes * exceptionally with a CompletionException with this exception as * cause. * * @return the new CompletionStage ! * @since 9 */ public CompletionStage<T> minimalCompletionStage() { return uniAsMinimalStage(); }
*** 2492,2502 **** * * @param supplier a function returning the value to be used * to complete this CompletableFuture * @param executor the executor to use for asynchronous execution * @return this CompletableFuture ! * @since 1.9 */ public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, Executor executor) { if (supplier == null || executor == null) throw new NullPointerException(); --- 2492,2502 ---- * * @param supplier a function returning the value to be used * to complete this CompletableFuture * @param executor the executor to use for asynchronous execution * @return this CompletableFuture ! * @since 9 */ public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier, Executor executor) { if (supplier == null || executor == null) throw new NullPointerException();
*** 2510,2520 **** * default executor. * * @param supplier a function returning the value to be used * to complete this CompletableFuture * @return this CompletableFuture ! * @since 1.9 */ public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) { return completeAsync(supplier, defaultExecutor()); } --- 2510,2520 ---- * default executor. * * @param supplier a function returning the value to be used * to complete this CompletableFuture * @return this CompletableFuture ! * @since 9 */ public CompletableFuture<T> completeAsync(Supplier<? extends T> supplier) { return completeAsync(supplier, defaultExecutor()); }
*** 2526,2536 **** * @param timeout how long to wait before completing exceptionally * with a TimeoutException, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return this CompletableFuture ! * @since 1.9 */ public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) { if (unit == null) throw new NullPointerException(); if (result == null) --- 2526,2536 ---- * @param timeout how long to wait before completing exceptionally * with a TimeoutException, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return this CompletableFuture ! * @since 9 */ public CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) { if (unit == null) throw new NullPointerException(); if (result == null)
*** 2547,2557 **** * @param timeout how long to wait before completing normally * with the given value, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return this CompletableFuture ! * @since 1.9 */ public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) { if (unit == null) throw new NullPointerException(); --- 2547,2557 ---- * @param timeout how long to wait before completing normally * with the given value, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code timeout} parameter * @return this CompletableFuture ! * @since 9 */ public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) { if (unit == null) throw new NullPointerException();
*** 2571,2581 **** * @param delay how long to delay, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code delay} parameter * @param executor the base executor * @return the new delayed executor ! * @since 1.9 */ public static Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) { if (unit == null || executor == null) throw new NullPointerException(); --- 2571,2581 ---- * @param delay how long to delay, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code delay} parameter * @param executor the base executor * @return the new delayed executor ! * @since 9 */ public static Executor delayedExecutor(long delay, TimeUnit unit, Executor executor) { if (unit == null || executor == null) throw new NullPointerException();
*** 2590,2600 **** * * @param delay how long to delay, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code delay} parameter * @return the new delayed executor ! * @since 1.9 */ public static Executor delayedExecutor(long delay, TimeUnit unit) { if (unit == null) throw new NullPointerException(); return new DelayedExecutor(delay, unit, ASYNC_POOL); --- 2590,2600 ---- * * @param delay how long to delay, in units of {@code unit} * @param unit a {@code TimeUnit} determining how to interpret the * {@code delay} parameter * @return the new delayed executor ! * @since 9 */ public static Executor delayedExecutor(long delay, TimeUnit unit) { if (unit == null) throw new NullPointerException(); return new DelayedExecutor(delay, unit, ASYNC_POOL);
*** 2606,2616 **** * interface {@link CompletionStage}. * * @param value the value * @param <U> the type of the value * @return the completed CompletionStage ! * @since 1.9 */ public static <U> CompletionStage<U> completedStage(U value) { return new MinimalStage<U>((value == null) ? NIL : value); } --- 2606,2616 ---- * interface {@link CompletionStage}. * * @param value the value * @param <U> the type of the value * @return the completed CompletionStage ! * @since 9 */ public static <U> CompletionStage<U> completedStage(U value) { return new MinimalStage<U>((value == null) ? NIL : value); }
*** 2619,2629 **** * exceptionally with the given exception. * * @param ex the exception * @param <U> the type of the value * @return the exceptionally completed CompletableFuture ! * @since 1.9 */ public static <U> CompletableFuture<U> failedFuture(Throwable ex) { if (ex == null) throw new NullPointerException(); return new CompletableFuture<U>(new AltResult(ex)); } --- 2619,2629 ---- * exceptionally with the given exception. * * @param ex the exception * @param <U> the type of the value * @return the exceptionally completed CompletableFuture ! * @since 9 */ public static <U> CompletableFuture<U> failedFuture(Throwable ex) { if (ex == null) throw new NullPointerException(); return new CompletableFuture<U>(new AltResult(ex)); }
*** 2634,2644 **** * methods in interface {@link CompletionStage}. * * @param ex the exception * @param <U> the type of the value * @return the exceptionally completed CompletionStage ! * @since 1.9 */ public static <U> CompletionStage<U> failedStage(Throwable ex) { if (ex == null) throw new NullPointerException(); return new MinimalStage<U>(new AltResult(ex)); } --- 2634,2644 ---- * methods in interface {@link CompletionStage}. * * @param ex the exception * @param <U> the type of the value * @return the exceptionally completed CompletionStage ! * @since 9 */ public static <U> CompletionStage<U> failedStage(Throwable ex) { if (ex == null) throw new NullPointerException(); return new MinimalStage<U>(new AltResult(ex)); }
< prev index next >