Automatically determine the last stages in CompositeStage
Current situation: A user needs to indicate the last stages for a composite stage.
Problem:
- There is no check whether the indicated stages are really the last stages.
- Moreover, the last stages could be indicated in an inefficient way. Consider the following example. A new list of the last stages of the
CompositeStage
is created whenever it is returned.
@Override
protected Collection<? extends Stage> getLastStages() {
return Arrays.asList(this.callCollector, this.failedCallCollector, this.aggCallCollector, this.aggFailedCallCollector);
}
A solution: Automatically determine the last stages. A graph traversor could start with the first stage and traverse the composite structure. If it reaches a leaf, it adds the leaf to the list of last stages. Benefit:
- The last stages are always the real last stages of the composite stage.
- The stage developer needs to write less code.