-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/action manager priority queue #1526
Feature/action manager priority queue #1526
Conversation
…bsequent classes, resulting in the throttled task runner using a priorityBlockingQueue to implement the prioritization
the joys of mockity any
… to the ThreadPoolExecutor to use a custom one that respects priority even when the task gets deferred.
String fullName = String.format("%s (%s)", name, UUID.randomUUID().toString()); | ||
|
||
ActionManagerImpl manager = new ActionManagerImpl(fullName, taskRunner, resourceResolver, saveInterval); | ||
ActionManagerImpl manager = new ActionManagerImpl(fullName, taskRunner, resourceResolver, saveInterval, priroty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misspelled priority
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly the sort of high quality code review I expect.
Snark aside, will fix this, thanks for pointing it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, it's open-source. You're getting so much more than you paid for already! ;P But seriously, thanks for the awesome PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from needing one minor spelling correction, it looks great!
I think this is mostly self explanatory. By adding an optional parameter to the action manager for the priority, we can give tasks a priority and order their execution based on this priority.
While this does not exactly guarantee the order of execution (could vary depending on how long various tasks take), it does allow you to order tasks that are more important first. For example, you may want to execute more resource intensive tasks first to free up those resources for other things.