Interface AggregateCompletionStage<R>


  • public interface AggregateCompletionStage<R>
    Aggregation of multiple CompletionStage instances where their count is not known or when a large amount of stages are required, as it uses less memory foot print per stage.

    This stage allows for multiple CompletionStages to be registered via dependsOn(CompletionStage). This AggregateCompletionStage will not complete until it is frozen via freeze() and all of the registered CompletionStages complete. If one of the stages that is being depended upon completes with an exception this AggregateCompletionStage will complete with the same Throwable cause after all stages are complete.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      AggregateCompletionStage<R> dependsOn​(java.util.concurrent.CompletionStage<?> stage)
      Adds another CompletionStage for this stage to be reliant upon.
      java.util.concurrent.CompletionStage<R> freeze()
      Marks this composed stage as frozen, allowing it to complete when all stages it depends on complete
    • Method Detail

      • dependsOn

        AggregateCompletionStage<R> dependsOn​(java.util.concurrent.CompletionStage<?> stage)
        Adds another CompletionStage for this stage to be reliant upon.

        If this CombinedCompletionStage is frozen, it will throw an IllegalStateException

        Parameters:
        stage - stage to depend on
        Returns:
        this stage
      • freeze

        java.util.concurrent.CompletionStage<R> freeze()
        Marks this composed stage as frozen, allowing it to complete when all stages it depends on complete
        Returns:
        this stage