RFR: JDK-8319662 ForkJoinPool trims worker threads too slowly
Viktor Klang
vklang at openjdk.org
Mon Nov 20 11:26:32 UTC 2023
On Sun, 19 Nov 2023 17:36:01 GMT, Doug Lea <dl at openjdk.org> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16725#discussion_r1399055155
More information about the core-libs-dev
mailing list