RFR: 8319447: Improve performance of delayed task handling [v4]

Doug Lea dl at openjdk.org
Wed Feb 26 12:54:04 UTC 2025


On Wed, 26 Feb 2025 10:13:12 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Standardize parameter checking
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 3131:
> 
>> 3129:         if ((p = (cp = common).parallelism) < 2)
>> 3130:             U.compareAndSetInt(cp, PARALLELISM, p, 2);
>> 3131:         return cp;
> 
> Is this okay for deployments that run with java.util.concurrent.ForkJoinPool.common.parallelism set?

Yes, but we must override only if set to 0. So changed to:
+        if ((p = (cp = common).parallelism) == 0)
+            U.compareAndSetInt(cp, PARALLELISM, 0, 2);

If users set to 1, some async CompletableFuture usages that used to bypass may run more slowly (or more quickly because of less overhead).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23702#discussion_r1971531909


More information about the core-libs-dev mailing list