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

Doug Lea dl at openjdk.org
Tue Feb 25 22:18:01 UTC 2025


On Tue, 25 Feb 2025 17:06:31 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Doug Lea has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Standardize parameter checking
>
> test/jdk/java/util/concurrent/tck/ForkJoinPool20Test.java line 577:
> 
>> 575:                 Thread.sleep(LONGER_DELAY_MS); return Boolean.TRUE; }};
>> 576:         ForkJoinTask<?> task = p.submitWithTimeout(c, 1, NANOSECONDS, null);
>> 577:         Thread.sleep(timeoutMillis());
> 
> Do we need to sleep here or just get the result with a timeout expecting a CancellationException then asserting isCancelled == true?

This checks: The task is not run and will eventually show up as cancelled. So as is done in other juc-tck test, we sleep a little for the "eventually" part. This and many similar cases can rarely misfire, in which case timeoutMillis is increased as a check by harness.

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

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


More information about the core-libs-dev mailing list