I'm designing a framework and I have composite objects that have sub objects that are executed asynchronously or synchronously. For the synchronous executing ones, there's usually a certain type of logic that has to run in the composite object after a certain sub item finished.
The issue is there's a number of sub items and for each sub item, there could be a different processing done after each sub item, and because i was aiming for simplicity, i had the synchronous items on a queue and composite item would just pop them one by one and run them.. Now what would be the cleanest way to track the sub items so that I can say something like "after sub item #2 is finished, take the data it returned and do xyz()"?