On Thu, 21 Nov 2024 20:46:47 GMT, Brent Christian <bchri...@openjdk.org> wrote:
>> src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line >> 451: >> >>> 449: // Add shutdown hook to flush cached prefs on normal >>> termination >>> 450: Runtime.getRuntime().addShutdownHook( >>> 451: new Thread(null, null, "Sync Timer Thread", 0, false) { >> >> Future work, use a Virtual thread for this. > > https://bugs.openjdk.org/browse/JDK-8344793 I'm not sure that this make sense. A shutdown hook is an unstarted Thread so it's not bound to an OS thread at this point. Main issue with using a virtual thread as a shutdown hook is that it might be the first usage of virtual threads and so it would be starting a new carrier to run this really short lived task to cancel the timer. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22252#discussion_r1853389835