On Fri, 1 Oct 2021 05:10:17 GMT, David Holmes <[email protected]> wrote:
>> A regression introduced in Java 17 will give the default FJ pool a
>> parallelism of zero in a uniprocessor environment. The fix restores this to
>> a value of 1. See bug report for details.
>>
>> Testing:
>> - new regression test
>> - tiers 1-3
>>
>> Thanks,
>> David
>
> David Holmes has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Updated TCK test component from @martin
Marked as reviewed by martin (Reviewer).
I always try to avoid Thread.sleep or polling in tests, so I would write the
test like this:
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ForkJoinPool;
public class ForkJoinUniProcessor {
public static void main(String[] args) throws InterruptedException {
// If the default parallelism were zero then this task would not
// complete and the test will timeout.
CountDownLatch ran = new CountDownLatch(1);
ForkJoinPool.commonPool().submit(() -> ran.countDown());
ran.await();
}
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/5784