CompletionStage.whenComplete

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.

<p>When this stage is complete, the given function is invoked with the result (or {@code null} if none) and the exception (or {@code null} if none) of this stage as arguments, and the function's result is used to complete the returned stage.

@param fn the function to use to compute the value of the returned CompletionStage @param executor the executor to use for asynchronous execution @param (U) the function's return type @return the new CompletionStage

  1. CompletionStage!(T) whenComplete(Action1!(Throwable) action)
    interface CompletionStage(T)
    static if(is(T == void))
    whenComplete
    (
    Action1!(Throwable) action
    )
  2. CompletionStage!(T) whenComplete(BiConsumer!(T, Throwable) action)

Meta