Confgurable executor service for IRP queue #2
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.
This is a supplement to original PR. It goes a little further, but I think helps solve the initial issues in my first PR, while adding more customization and removing concurrency-control code.
My latest research into the IRP queue stuff has been aimed at reducing thread count and creation. Obviously each device must keep its queue non-parallel, but there are still different execution strategies a user may want to choose (maybe only one thread for the process? higher latency, but may work for some use cases). In my case ill be using Akka actors with a custom dispatcher to maintain queue locality, while sharing a thread pool. This will help me break my worst-case 2-thread per device complexity.
Using an executorservice also helps move thread control out of the codebase. There are tonnss of great patterns you could implement with that control, and the default java executors are really solid. At first I just wanted to add a timeout to the IRP queue thread, but noticed I could do all that with the standard executors.