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

Sunmisc Unsafe duke at openjdk.org
Wed Mar 5 23:59:00 UTC 2025


On Wed, 5 Mar 2025 15:13:06 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reduce volatile reads
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 3741:
> 
>> 3739:     public <V> ForkJoinTask<V> submitWithTimeout(Callable<V> callable,
>> 3740:                                                  long timeout, TimeUnit unit,
>> 3741:                                                  Consumer<ForkJoinTask<V>> timeoutAction) {
> 
> I wonder if the variance of the Consumer to this method should be more permissible. Something like:
> 
> public <V> ForkJoinTask<V> submitWithTimeout(Callable<V> callable,
>                                                  long timeout, TimeUnit unit,
>                                                  Consumer<? super ForkJoinTask<? extends V>> timeoutAction) {

Maybe it's worth using java.time.Duration, although it doesn't fit into the API very elegantly.

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

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


More information about the core-libs-dev mailing list