join
and get
methods
Future
that may be explicitly completed (setting its
value and status), and may be used as a CompletionStage
,
supporting dependent functions and actions that trigger upon its
completion.
When two or more threads attempt to
complete
,
completeExceptionally
, or
cancel
a CompletableFuture, only one of them succeeds.
In addition to these and related methods for directly
manipulating status and results, CompletableFuture implements
interface CompletionStage
with the following policies:
ForkJoinPool#commonPool()
(unless it does not support a parallelism level of at least two, in
which case, a new Thread is created to run each task). This may be
overridden for non-static methods in subclasses by defining method
defaultExecutor()
. To simplify monitoring, debugging,
and tracking, all generated asynchronous tasks are instances of the
marker interface AsynchronousCompletionTask
. Operations
with time-delays can use adapter methods defined in this class, for
example: supplyAsync(supplier, delayedExecutor(timeout,
timeUnit))
. To support methods with delays and timeouts, this
class maintains at most one daemon thread for triggering and
cancelling actions, not for running them.
minimalCompletionStage
. Or to
ensure only that clients do not themselves modify a future, use
method copy
.
CompletableFuture also implements Future
with the following
policies:
FutureTask
) this class has no direct
control over the computation that causes it to be completed,
cancellation is treated as just another form of exceptional
completion. Method cancel
has the same effect as
completeExceptionally(new CancellationException())
. Method
isCompletedExceptionally
can be used to determine if a
CompletableFuture completed in any exceptional fashion.
get()
and get(long, TimeUnit)
throw an
ExecutionException
with the same cause as held in the
corresponding CompletionException. To simplify usage in most
contexts, this class also defines methods join()
and
getNow
that instead throw the CompletionException directly
in these cases.
Arguments used to pass a completion result (that is, for
parameters of type T
) for methods accepting them may be
null, but passing a null value for any other parameter will result
in a NullPointerException
being thrown.
Subclasses of this class should normally override the "virtual
constructor" method newIncompleteFuture
, which establishes
the concrete type returned by CompletionStage methods. For example,
here is a class that substitutes a different default Executor and
disables the obtrude
methods:
class MyCompletableFuture<T> extends CompletableFuture<T> {
static final Executor myExecutor = ...;
public MyCompletableFuture() { }
public <U> CompletableFuture<U> newIncompleteFuture() {
return new MyCompletableFuture<U>(); }
public Executor defaultExecutor() {
return myExecutor; }
public void obtrudeValue(T value) {
throw new UnsupportedOperationException(); }
public void obtrudeException(Throwable ex) {
throw new UnsupportedOperationException(); }
}
Modifier and Type | Class and Description |
---|---|
pack-priv static class | |
pack-priv static class | CompletableFuture.
Completion for an anyOf input future. |
public static interface | CompletableFuture.
A marker interface identifying asynchronous tasks produced by
|
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv abstract static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | CompletableFuture.
Action to cancel unneeded timeouts |
pack-priv static class | CompletableFuture.
A Completion delegating to a BiCompletion |
pack-priv abstract static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | CompletableFuture.
Singleton delay scheduler, used only for starting and cancelling tasks. |
pack-priv static class | CompletableFuture.
A subclass that just throws UOE for most non-CompletionStage methods. |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | CompletableFuture.
Completion for recording and releasing a waiting thread. |
pack-priv static class | CompletableFuture.
Action to submit user task |
private static class | CompletableFuture.
Fallback if ForkJoinPool.commonPool() cannot support parallelism |
pack-priv static class | CompletableFuture.
Action to completeExceptionally on timeout |
pack-priv static class | |
pack-priv static class | |
pack-priv abstract static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class | |
pack-priv static class |
Modifier and Type | Field and Description |
---|---|
pack-priv static final int | |
private static final Executor | ASYNC_POOL
Default executor -- ForkJoinPool.commonPool() unless it cannot support parallelism. |
pack-priv static final int | |
private static final VarHandle | |
pack-priv static final CompletableFuture. | NIL
The encoding of the null value. |
pack-priv volatile Object | |
private static final VarHandle | |
pack-priv volatile CompletableFuture. | |
private static final VarHandle | |
pack-priv static final int | |
private static final boolean |
Access | Constructor and Description |
---|---|
public | |
pack-priv |
Modifier and Type | Method and Description |
---|---|
public CompletableFuture | acceptEither(CompletionStage<? extends T>
the other CompletionStage other, Consumer<? super T> the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied action. |
public CompletableFuture | acceptEitherAsync(CompletionStage<? extends T>
the other CompletionStage other, Consumer<? super T> the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied action. |
public CompletableFuture | acceptEitherAsync(CompletionStage<? extends T>
the other CompletionStage other, Consumer<? super T> the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied action. |
public static CompletableFuture | Returns: a new CompletableFuture that is completed when all of the given CompletableFutures completethe CompletableFutures cfs)Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete. |
pack-priv static CompletableFuture | |
public static CompletableFuture | Returns: a new CompletableFuture that is completed with the result or exception of any of the given CompletableFutures when one completesthe CompletableFutures cfs)Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result. |
public <U> CompletableFuture | applyToEither(CompletionStage<? extends T>
the other CompletionStage other, Function<? super T, U> the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function. |
public <U> CompletableFuture | applyToEitherAsync(CompletionStage<? extends T>
the other CompletionStage other, Function<? super T, U> the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using this stage's default asynchronous execution facility, with the corresponding result as argument to the supplied function. |
public <U> CompletableFuture | applyToEitherAsync(CompletionStage<? extends T>
the other CompletionStage other, Function<? super T, U> the function to use to compute the value of the
returned CompletionStage fn, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed using the supplied executor, with the corresponding result as argument to the supplied function. |
pack-priv static CompletableFuture | |
pack-priv static <U> CompletableFuture | |
pack-priv final <R, S> boolean | biAccept(Object r, Object s, BiConsumer<? super R, ? super S> f, CompletableFuture.
|
private <U> CompletableFuture | |
pack-priv final <R, S> boolean | biApply(Object r, Object s, BiFunction<? super R, ? super S, ? extends T> f, CompletableFuture.
|
private <U, V> CompletableFuture | |
pack-priv final void | bipush(CompletableFuture<?> b, CompletableFuture.
Pushes completion to this and b unless both done. |
pack-priv final boolean | |
private CompletableFuture | |
public boolean | Returns: true if this task is now cancelledthis value has no effect in this
implementation because interrupts are not used to control
processing. mayInterruptIfRunning)Implements java. If not already completed, completes this CompletableFuture with
a |
pack-priv final void | |
public boolean | |
public CompletableFuture | Returns: this CompletableFuturea function returning the value to be used
to complete this CompletableFuture supplier, Executor the executor to use for asynchronous execution executor)Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor. |
public CompletableFuture | Returns: this CompletableFuturea function returning the value to be used
to complete this CompletableFuture supplier)Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor. |
public static < the type of the value U> CompletableFuture | Returns: the completed CompletableFuturethe value value)Returns a new CompletableFuture that is already completed with the given value. |
public static < the type of the value U> CompletionStage | Returns: the completed CompletionStagethe value value)Returns a new CompletionStage that is already completed with
the given value and supports only those methods in
interface |
public boolean | Returns: true if this invocation caused this CompletableFuture
to transition to a completed state, else false the exception ex)If not already completed, causes invocations of |
pack-priv final boolean | |
public CompletableFuture | Returns: this CompletableFuturethe value to use upon timeout value, long how long to wait before completing normally
with the given value, in units of timeout, TimeUnit unit a unit)TimeUnit determining how to interpret the
timeout parameterCompletes this CompletableFuture with the given value if not otherwise completed before the given timeout. |
pack-priv final boolean | |
pack-priv final boolean | |
pack-priv final boolean | completeThrowable(Throwable x, Object r)
Completes with the given (non-null) exceptional result as a wrapped CompletionException unless it is one already, unless already completed. |
pack-priv final boolean | |
public CompletableFuture | Returns: the new CompletableFutureReturns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally. |
public Executor | Returns: the executorReturns the default Executor used for async methods that do not specify an Executor. |
public static Executor | Returns: the new delayed executorhow long to delay, in units of delay, TimeUnit unit a unit, Executor TimeUnit determining how to interpret the
delay parameterthe base executor executor)Returns a new Executor that submits a task to the given base executor after the given delay (or no delay if non-positive). |
public static Executor | Returns: the new delayed executorhow long to delay, in units of delay, TimeUnit unit a unit)TimeUnit determining how to interpret the
delay parameterReturns a new Executor that submits a task to the default executor after the given delay (or no delay if non-positive). |
pack-priv Object | encodeOutcome(T t, Throwable x)
Returns the encoding of the given arguments: if the exception is non-null, encodes as AltResult. |
pack-priv static Object | encodeRelay(Object r)
Returns the encoding of a copied outcome; if exceptional, rewraps as a CompletionException, else returns argument. |
pack-priv static CompletableFuture. | encodeThrowable(Throwable x)
Returns the encoding of the given (non-null) exception as a wrapped CompletionException unless it is one already. |
pack-priv static Object | encodeThrowable(Throwable x, Object r)
Returns the encoding of the given (non-null) exception as a wrapped CompletionException unless it is one already. |
pack-priv final Object | |
public CompletableFuture | exceptionally(Function<Throwable, ? extends T>
the function to use to compute the value of the
returned CompletionStage if this CompletionStage completed
exceptionally fn)Implements java. Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function. |
public CompletableFuture | exceptionallyAsync(Function<Throwable, ? extends T>
the function to use to compute the value of the
returned CompletionStage if this CompletionStage completed
exceptionally fn)Overrides default java. Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using this stage's default asynchronous execution facility. |
public CompletableFuture | exceptionallyAsync(Function<Throwable, ? extends T>
the function to use to compute the value of the
returned CompletionStage if this CompletionStage completed
exceptionally fn, Executor the executor to use for asynchronous execution executor)Overrides default java. Returns a new CompletionStage that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied function, using the supplied Executor. |
public CompletableFuture | exceptionallyCompose(Function<Throwable, ? extends CompletionStage<T>>
the function to use to compute the returned
CompletionStage if this CompletionStage completed exceptionally fn)Overrides default java. Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception. |
public CompletableFuture | exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>>
the function to use to compute the returned
CompletionStage if this CompletionStage completed exceptionally fn)Overrides default java. Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using this stage's default asynchronous execution facility. |
public CompletableFuture | exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>>
the function to use to compute the returned
CompletionStage if this CompletionStage completed exceptionally fn, Executor the executor to use for asynchronous execution executor)Overrides default java. Returns a new CompletionStage that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage's exception, using the supplied Executor. |
public Throwable | exceptionNow()
Overrides default java. Returns the exception thrown by the task, without waiting. |
public static < the type of the value U> CompletableFuture | Returns: the exceptionally completed CompletableFuturethe exception ex)Returns a new CompletableFuture that is already completed exceptionally with the given exception. |
public static < the type of the value U> CompletionStage | Returns: the exceptionally completed CompletionStagethe exception ex)Returns a new CompletionStage that is already completed
exceptionally with the given exception and supports only those
methods in interface |
public T | Returns: the result valueImplements java. Waits if necessary for this future to complete, and then returns its result. |
public T | Returns: the result valuethe maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. Waits if necessary for at most the given time for this future to complete, and then returns its result, if available. |
public T | Returns: the result value, if completed, else the given valueIfAbsentthe value to return if not completed valueIfAbsent)Returns the result value (or throws any encountered exception) if completed, else returns the given valueIfAbsent. |
public int | Returns: the number of dependent CompletableFuturesReturns the estimated number of CompletableFutures whose completions are awaiting completion of this CompletableFuture. |
public <U> CompletableFuture | handle(BiFunction<? super T, Throwable, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed with this stage's result and exception as arguments to the supplied function. |
public <U> CompletableFuture | handleAsync(BiFunction<? super T, Throwable, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed using this stage's default asynchronous execution facility, with this stage's result and exception as arguments to the supplied function. |
public <U> CompletableFuture | handleAsync(BiFunction<? super T, Throwable, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this stage completes either normally or exceptionally, is executed using the supplied executor, with this stage's result and exception as arguments to the supplied function. |
pack-priv final boolean | |
public boolean | Returns: true if this CompletableFuture was cancelled
before it completed normallyImplements java. Returns |
public boolean | Returns: true if this CompletableFuture completed
exceptionallyReturns |
public boolean | Returns: true if completedImplements java. Returns |
public T | Returns: the result valueReturns the result value when complete, or throws an (unchecked) exception if completed exceptionally. |
public CompletionStage | Returns: the new CompletionStageReturns a new CompletionStage that is completed normally with
the same value as this CompletableFuture when it completes
normally, and cannot be independently completed or otherwise
used in ways not defined by the methods of interface |
public < the type of the value U> CompletableFuture | Returns: a new CompletableFutureReturns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method. |
public void | obtrudeException(Throwable
the exception ex)Forcibly causes subsequent invocations of method |
public void | obtrudeValue(T
the completion value value)Forcibly sets or resets the value subsequently returned by
method |
private <U extends T> CompletableFuture | |
private <U extends T, V> CompletableFuture | |
pack-priv final void | orpush(CompletableFuture<?> b, CompletableFuture.
Pushes completion to this and b unless either done. |
private CompletableFuture | |
public CompletableFuture | Returns: this CompletableFuturehow long to wait before completing exceptionally
with a TimeoutException, in units of timeout, TimeUnit unit a unit)TimeUnit determining how to interpret the
timeout parameterExceptionally completes this CompletableFuture with
a |
pack-priv final void | |
pack-priv final CompletableFuture | postFire(CompletableFuture<?> a, int mode)
Post-processing by dependent after successful UniCompletion tryFire. |
pack-priv final CompletableFuture | postFire(CompletableFuture<?> a, CompletableFuture<?> b, int mode)
Post-processing after successful BiCompletion tryFire. |
pack-priv final void | pushStack(CompletableFuture.
Unconditionally pushes c onto stack, retrying if necessary. |
private static Object | |
private static Object | |
public T | resultNow()
Overrides default java. Returns the computed result, without waiting. |
public CompletableFuture | runAfterBoth(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action. |
public CompletableFuture | runAfterBothAsync(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using this stage's default asynchronous execution facility. |
public CompletableFuture | runAfterBothAsync(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, executes the given action using the supplied executor. |
public CompletableFuture | runAfterEither(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action. |
public CompletableFuture | runAfterEitherAsync(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using this stage's default asynchronous execution facility. |
public CompletableFuture | runAfterEitherAsync(CompletionStage<?>
the other CompletionStage other, Runnable the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when either this or the other given stage complete normally, executes the given action using the supplied executor. |
public static CompletableFuture | Returns: the new CompletableFuturethe action to run before completing the
returned CompletableFuture runnable)Returns a new CompletableFuture that is asynchronously completed
by a task running in the |
public static CompletableFuture | Returns: the new CompletableFuturethe action to run before completing the
returned CompletableFuture runnable, Executor the executor to use for asynchronous execution executor)Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action. |
pack-priv static Executor | screenExecutor(Executor e)
Null-checks user executor argument, and translates uses of commonPool to ASYNC_POOL in case parallelism disabled. |
public Future. | |
public static < the function's return type U> CompletableFuture | Returns: the new CompletableFuturea function returning the value to be used
to complete the returned CompletableFuture supplier)Returns a new CompletableFuture that is asynchronously completed
by a task running in the |
public static < the function's return type U> CompletableFuture | Returns: the new CompletableFuturea function returning the value to be used
to complete the returned CompletableFuture supplier, Executor the executor to use for asynchronous execution executor)Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier. |
public CompletableFuture | thenAccept(Consumer<? super T>
the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied action. |
public CompletableFuture | thenAcceptAsync(Consumer<? super T>
the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed using this stage's default asynchronous execution facility, with this stage's result as the argument to the supplied action. |
public CompletableFuture | thenAcceptAsync(Consumer<? super T>
the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied action. |
public <U> CompletableFuture | thenAcceptBoth(CompletionStage<? extends U>
the other CompletionStage other, BiConsumer<? super T, ? super U> the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied action. |
public <U> CompletableFuture | thenAcceptBothAsync(CompletionStage<? extends U>
the other CompletionStage other, BiConsumer<? super T, ? super U> the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using this stage's default asynchronous execution facility, with the two results as arguments to the supplied action. |
public <U> CompletableFuture | thenAcceptBothAsync(CompletionStage<? extends U>
the other CompletionStage other, BiConsumer<? super T, ? super U> the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied action. |
public <U> CompletableFuture | thenApply(Function<? super T, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed with this stage's result as the argument to the supplied function. |
public <U> CompletableFuture | thenApplyAsync(Function<? super T, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed using this stage's default asynchronous execution facility, with this stage's result as the argument to the supplied function. |
public <U> CompletableFuture | thenApplyAsync(Function<? super T, ? extends U>
the function to use to compute the value of the
returned CompletionStage fn, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this stage completes normally, is executed using the supplied Executor, with this stage's result as the argument to the supplied function. |
public <U, V> CompletableFuture | thenCombine(CompletionStage<? extends U>
the other CompletionStage other, BiFunction<? super T, ? super U, ? extends V> the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed with the two results as arguments to the supplied function. |
public <U, V> CompletableFuture | thenCombineAsync(CompletionStage<? extends U>
the other CompletionStage other, BiFunction<? super T, ? super U, ? extends V> the function to use to compute the value of the
returned CompletionStage fn)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using this stage's default asynchronous execution facility, with the two results as arguments to the supplied function. |
public <U, V> CompletableFuture | thenCombineAsync(CompletionStage<? extends U>
the other CompletionStage other, BiFunction<? super T, ? super U, ? extends V> the function to use to compute the value of the
returned CompletionStage fn, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this and the other given stage both complete normally, is executed using the supplied executor, with the two results as arguments to the supplied function. |
public <U> CompletableFuture | thenCompose(Function<? super T, ? extends CompletionStage<U>>
the function to use to compute another CompletionStage fn)Implements java. Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function. |
public <U> CompletableFuture | thenComposeAsync(Function<? super T, ? extends CompletionStage<U>>
the function to use to compute another CompletionStage fn)Implements java. Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function, executed using this stage's default asynchronous execution facility. |
public <U> CompletableFuture | thenComposeAsync(Function<? super T, ? extends CompletionStage<U>>
the function to use to compute another CompletionStage fn, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that is completed with the same value as the CompletionStage returned by the given function, executed using the supplied Executor. |
public CompletableFuture | thenRun(Runnable
the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this stage completes normally, executes the given action. |
public CompletableFuture | thenRunAsync(Runnable
the action to perform before completing the
returned CompletionStage action)Implements java. Returns a new CompletionStage that, when this stage completes normally, executes the given action using this stage's default asynchronous execution facility. |
public CompletableFuture | thenRunAsync(Runnable
the action to perform before completing the
returned CompletionStage action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage that, when this stage completes normally, executes the given action using the supplied Executor. |
private Object | timedGet(long nanos)
Returns raw result after waiting, or null if interrupted, or throws TimeoutException on timeout. |
public CompletableFuture | Returns: this CompletableFutureImplements java. Returns this CompletableFuture. |
public String | Returns: a string identifying this CompletableFuture, as well as its stateOverrides java. Returns a string identifying this CompletableFuture, as well as its completion state. |
pack-priv final boolean | |
private CompletableFuture | |
private CompletableFuture | |
private <V> CompletableFuture | |
private <V> CompletableFuture | |
private CompletableFuture. | |
private CompletableFuture | |
private <V> CompletableFuture | |
private static <U, T extends U> CompletableFuture | |
pack-priv final boolean | uniExceptionally(Object r, Function<? super Throwable, ? extends T> f, CompletableFuture.
|
private CompletableFuture | |
pack-priv final <S> boolean | uniHandle(Object r, BiFunction<? super S, Throwable, ? extends T> f, CompletableFuture.
|
private <V> CompletableFuture | |
pack-priv final void | unipush(CompletableFuture.
Pushes the given completion unless it completes while trying. |
private CompletableFuture | |
private CompletableFuture | |
pack-priv final boolean | uniWhenComplete(Object r, BiConsumer<? super T, ? super Throwable> f, CompletableFuture.
|
private CompletableFuture | |
private Object | waitingGet(boolean interruptible)
Returns raw result after waiting, or null if interruptible and interrupted. |
public CompletableFuture | whenComplete(BiConsumer<? super T, ? super Throwable>
the action to perform action)Implements java. Returns a new CompletionStage with the same result or exception as this stage, that executes the given action when this stage completes. |
public CompletableFuture | whenCompleteAsync(BiConsumer<? super T, ? super Throwable>
the action to perform action)Implements java. Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using this stage's default asynchronous execution facility when this stage completes. |
public CompletableFuture | whenCompleteAsync(BiConsumer<? super T, ? super Throwable>
the action to perform action, Executor the executor to use for asynchronous execution executor)Implements java. Returns a new CompletionStage with the same result or exception as this stage, that executes the given action using the supplied Executor when this stage completes. |
pack-priv static CompletionException | |
pack-priv static ExecutionException |