Refactoring: Move topology and arrow bookkeeping into JScheduler #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, our design attempted to separate the logic for shutting down individual arrows (and ultimately the whole topology) from the scheduling logic. These two things are not in fact independent, and this led to many headaches and issues such as #227. This refactoring moves all shutdown logic and bookkeeping state into the scheduler so that everyone sees a consistent view of the entire topology status. This gets rid of a number of atomic variables and puts everything behind one mutex. This improves the legibility of the design because the JScheduler class now encapsulates all state that needs the mutex's protection. This is not expected to hurt performance because the topology shutdown only happens at the very end of processing, and is ~O(number of arrows), which in typical use cases ranges from 2 to 6.