Skip to content

Conversation

@echicoine-icf
Copy link
Contributor

Adjusted ThreadUtils after discovering macOS/linux does not handle cached executor as Windows does. Executor set to fixed thread pool (cpu core count * 2)

  • Github Issue:
  • I've read the contribution guidelines
  • Code compiles without errors
  • Tests are created / updated
  • Documentation is created / updated

By creating this PR you acknowledge that your contribution will be licensed under Apache 2.0

@codecov
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 21.43%. Comparing base (0bead88) to head (e8f1ac9).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


private static List<ExecutorService> runningExecutors = new ArrayList<>();

private static final int threadPoolCount = Runtime.getRuntime().availableProcessors() * 2;
Copy link
Contributor

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

Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants