-
Notifications
You must be signed in to change notification settings - Fork 25
ThreadUtils thread count adjusted to limited value to avoid lockups #555
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
base: master
Are you sure you want to change the base?
ThreadUtils thread count adjusted to limited value to avoid lockups #555
Conversation
…n unix based operating systems.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #555 +/- ##
=========================================
Coverage 21.42% 21.43%
Complexity 1703 1703
=========================================
Files 303 303
Lines 26379 26382 +3
Branches 4204 4204
=========================================
+ Hits 5653 5656 +3
Misses 19787 19787
Partials 939 939 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| private static List<ExecutorService> runningExecutors = new ArrayList<>(); | ||
|
|
||
| private static final int threadPoolCount = Runtime.getRuntime().availableProcessors() * 2; |
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.
Using a magic number heuristic here. It makes sense in context, but I would prefer a safer approach, like the following:
private static final int threadPoolCount = Integer.getInteger("threadutils.pool.count", Runtime.getRuntime().availableProcessors());
This allows configuration to override e.g. -Dthreadutils.pool.count=8
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.
Using a magic number heuristic here. It makes sense in context, but I would prefer a safer approach, like the following:
private static final int threadPoolCount = Integer.getInteger("threadutils.pool.count", Runtime.getRuntime().availableProcessors());This allows configuration to override e.g.
-Dthreadutils.pool.count=8
I do like this better. Thank you!
…into threadutils-threadcount
Adjusted ThreadUtils after discovering macOS/linux does not handle cached executor as Windows does. Executor set to fixed thread pool (cpu core count * 2)
By creating this PR you acknowledge that your contribution will be licensed under Apache 2.0