On Mon, 20 Nov 2023 11:23:54 GMT, Viktor Klang <[email protected]> wrote:
>> This update cascades timeouts to trim subsequent workers after the first
>> keepAlive inactive period.
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2140:
>
>> 2138: Thread.interrupted(); // clear for next park
>> 2139: if (deadline != 0L && // try to trim on
>> timeout
>> 2140: deadline - System.currentTimeMillis() < TIMEOUT_SLOP) {
>
> Since `currentTimeMillis()` is fetched from system time, I think it might be
> more appropriate to use nanoTime() to track delays.
It would be better, but absolute-time Unsafe.park only operates at millisecond
accuracy (and even at that may misfire early, requiring TIMEOUT_SLOP.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16725#discussion_r1399210760