RFR: 8338765: ScheuledThreadPoolExecutor struggles with extremely long delays

Doug Lea dl at openjdk.org
Tue Aug 27 07:07:36 UTC 2024


On Wed, 21 Aug 2024 11:10:22 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Unfortunately there is no good, deterministic reproducer which can be used as a regression test at this point in time.
>
> src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java line 533:
> 
>> 531:      */
>> 532:     long triggerTime(long delay) {
>> 533:         return System.nanoTime() + Math.min(delay, MAX_NANOS);
> 
> The hi-res time source could have any long value so I'm wondering if it's okay for triggerTime to be negative.

System.nanoTime can be negative anyway (and only checked by subtraction). So this should be OK.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20653#discussion_r1725256010


More information about the core-libs-dev mailing list