On Tue, 18 Nov 2025 11:27:30 GMT, Renjith Kannath Pariyangad 
<[email protected]> wrote:

> Hi Reviewers,
> 
> Observed these two demon threads are created on class initializing time due 
> to static variable and static block call. Observed 
> [ScreencastHelper.isAvailable()](https://github.com/openjdk/jdk/blob/28d94d6ab4994b844af98c5c227b40b5fb8a72e5/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java#L1527)
>  from XToolkit.java call is enough to start these demon threads on latest 
> Linux (Gnome version 47 and above). In my observation  some simple workflows 
> not passing through the code where these **Watchers** are required, at the 
> same time threads are running because of the above reason. So moving those 
> into lazy loading will improve loading time and performance.
> 
> Please review and let me know your suggestions.
> 
> Renjith.

I'm not familiar with this part of the code, but this might be a good candidate 
for `StableValue` / `LazyConstant`, once it's ready? 
https://mail.openjdk.org/pipermail/client-libs-dev/2025-September/032518.html

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

PR Comment: https://git.openjdk.org/jdk/pull/28369#issuecomment-3548497817

Reply via email to