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

Doug Lea dl at openjdk.org
Sat Feb 22 12:19:53 UTC 2025


On Fri, 21 Feb 2025 16:34:32 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address feedback
>
> src/java.base/share/classes/java/util/concurrent/CompletableFuture.java line 2947:
> 
>> 2945:             e.scheduleDelayedTask(
>> 2946:                 new ScheduledForkJoinTask<Void>(
>> 2947:                     nanoDelay, 0L, true,
> 
> @DougLea Doesn't this mean that anyone can submit tasks which will be executed on the DelayedScheduler scheduling thread? If so, there's a big risk that things end up there which shouldn't be there, and could even compromise the liveness of said thread? 🤔

The task here is just TaskSubmitter's { executor.execute(action); }, which is assumed here (and in every other async  CF method) not to indefinitely block or loop. The class-level javadoc doesn't (and can't) strictly mandate this though.

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

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


More information about the core-libs-dev mailing list