Skip to content
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

Allow specifying ForkJoinPool saturate predicate #2792

Merged
merged 8 commits into from
Apr 10, 2022

Conversation

klease
Copy link
Contributor

@klease klease commented Dec 10, 2021

Add the method getSaturatePredicate to the interface ParallelExecutionConfiguration.
This allows a custom configuration to supply a predicate to handle the case
where the ForkJoinPool has reached the maximum pool size but all threads
are currently blocked.
Add a constructor to DefaultParallelExecutionConfiguration allowing to
speciy the predicate and modify the existing constructor to specify
null for the predicate.
Modify DefaultParallelExecutionConfigurationStrategyTests to check the
saturate predicate value in the default and custom configurations.

Issue: #2787

I hereby agree to the terms of the JUnit Contributor License Agreement.

Add the method getSaturatePredicate to the interface ParallelExecutionConfiguration.
This allows a custom configuration to supply a predicate to handle the case
where the ForkJoinPool has reached the maximum pool size but all threads
are currently blocked.
Add a constructor to DefaultParallelExecutionConfiguration allowing to
speciy the predicate and modify the existing constructor to specify
null for the predicate.
Modify DefaultParallelExecutionConfigurationStrategyTests to check the
saturate predicate value in the default and custom configurations.

Issue: junit-team#2787
Copy link
Member

@juliette-derancourt juliette-derancourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @klease, I made a few comments and launched the CI builds :)

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #2792 (06024e4) into main (c8fa9c3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #2792   +/-   ##
=========================================
  Coverage     91.30%   91.30%           
- Complexity     4509     4510    +1     
=========================================
  Files           390      391    +1     
  Lines         10936    10937    +1     
  Branches        846      846           
=========================================
+ Hits           9985     9986    +1     
  Misses          730      730           
  Partials        221      221           
Impacted Files Coverage Δ
...l/ForkJoinPoolHierarchicalTestExecutorService.java 94.11% <100.00%> (ø)
...t/hierarchical/ParallelExecutionConfiguration.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8fa9c3...06024e4. Read the comment docs.

@juliette-derancourt juliette-derancourt added this to the 5.9 M1 milestone Dec 11, 2021
@sbrannen sbrannen changed the title Extend ParallelExecutionConfiguration to specify a saturated predicate Extend ParallelExecutionConfiguration to specify a saturate predicate Dec 11, 2021
@christophs78
Copy link

christophs78 commented Jan 2, 2022

Also helps to address following issue related to Java 17 changes to ForkJoinPool: https://stackoverflow.com/questions/69768534/why-does-java-17-throw-a-rejectedexecutionexception-when-adding-tasks-to-a-forkj
May we ask to getting this released within weeks or a few months? There´s a bunch of people using JUnit 5 together with Selenium 4 which currently run into issues when using parallel execution.

@klease
Copy link
Contributor Author

klease commented Jan 18, 2022

All requested changes are now committed.

@marcphilipp marcphilipp dismissed juliette-derancourt’s stale review April 10, 2022 17:58

Comments have been addressed.

@marcphilipp marcphilipp changed the title Extend ParallelExecutionConfiguration to specify a saturate predicate Allow specifying ForkJoinPool saturate predicate Apr 10, 2022
@marcphilipp marcphilipp merged commit f42118e into junit-team:main Apr 10, 2022
@klease
Copy link
Contributor Author

klease commented Apr 10, 2022

Thanks @marcphilipp!

@marcphilipp
Copy link
Member

Thanks to you and sorry for the delay!

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

Successfully merging this pull request may close these issues.

Extend ParallelExecutionConfiguration to specify a predicate for determing if a pool is saturated
5 participants