CompletionStage.thenComposeAsync

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.

<p>When this stage completes normally, the given function is invoked with this stage's result as the argument, returning another CompletionStage. When that stage completes normally, the CompletionStage returned by this method is completed with the same value.

<p>To ensure progress, the supplied function must arrange eventual completion of its result.

<p>See the {@link CompletionStage} documentation for rules covering exceptional completion.

@param fn the function to use to compute another CompletionStage @param (U) the type of the returned CompletionStage's result @return the new CompletionStage

  1. CompletionStage!(U) thenComposeAsync(Function!(T, CompletionStage!(U)) fn)
    interface CompletionStage(T)
    thenComposeAsync
    (
    U
    )
    (
    Function!(T, CompletionStage!(U)) fn
    )
  2. CompletionStage!(U) thenComposeAsync(Function!(T, CompletionStage!(U)) fn, Executor executor)

Meta