Class Async<T>

Type Parameters:
T - the value type.
All Implemented Interfaces:
Flow.Processor<CompletionStage<T>,T>, Flow.Publisher<T>, Flow.Subscriber<CompletionStage<T>>

public class Async<T> extends ProcessorBase<CompletionStage<T>,T>
Emits the values produced by the stages in the order the stages arrive. The stream completes only after the last stage has completed.
Since:
1.5
Author:
Werner Donné
  • Constructor Details

    • Async

      public Async()
  • Method Details

    • async

      public static <T> Flow.Processor<CompletionStage<T>,T> async()
    • mapAsync

      public static <T, R> Flow.Processor<T,R> mapAsync(Function<T,CompletionStage<R>> function)
      Returns a processor with the mapping function, which transforms the objects. The completion stages are processed in the order of the stream, which completes only after the last stage is completed. This means the functions may start in parallel, but the completions are emitted in the proper order.
      Type Parameters:
      T - the incoming value type.
      R - the outgoing value type.
      Parameters:
      function - the mapping function.
      Returns:
      The processor.
      Since:
      3.0
    • emit

      protected void emit(long number)
      Specified by:
      emit in class ProcessorBase<CompletionStage<T>,T>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface Flow.Subscriber<T>
      Overrides:
      onComplete in class ProcessorBase<CompletionStage<T>,T>
    • onNext

      public void onNext(CompletionStage<T> stage)