CompletionStage.whenCompleteAsync

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.

<p>When this stage is complete, the given action is invoked with the result (or {@code null} if none) and the exception (or {@code null} if none) of this stage as arguments. The returned stage is completed when the action returns.

<p>Unlike method {@link #handleAsync(BiFunction,Executor) handleAsync}, this method is not designed to translate completion outcomes, so the supplied action should not throw an exception. However, if it does, the following rules apply: If this stage completed normally but the supplied action throws an exception, then the returned stage completes exceptionally with the supplied action's exception. Or, if this stage completed exceptionally and the supplied action throws an exception, then the returned stage completes exceptionally with this stage's exception.

@param action the action to perform @param executor the executor to use for asynchronous execution @return the new CompletionStage

  1. CompletionStage!(T) whenCompleteAsync(Action1!(Throwable) action)
  2. CompletionStage!(T) whenCompleteAsync(Action1!(Throwable) action, Executor executor)
  3. CompletionStage!(T) whenCompleteAsync(BiConsumer!(T, Throwable) action)
  4. CompletionStage!(T) whenCompleteAsync(BiConsumer!(T, Throwable) action, Executor executor)
    interface CompletionStage(T)
    static if(!(is(T == void)))
    whenCompleteAsync
    (
    BiConsumer!(T, Throwable) action
    ,)

Meta