On Wed, 26 Nov 2025 12:23:26 GMT, Alan Bateman <[email protected]> wrote:

>> Sure, I'm just pointing out that we have a load of existing nameToMBeanMap() 
>> methods that do things differently.
>> OK I now see this one is doing what the new VirtualThreadSchedulerMXBean did.
>> 
>> The others are different: commonly the nameToMBeanMap() methods in 
>> PlatformMBeanProviderImpl.java are synchronized, or they call a 
>> getXXMXBean() method which is synchronized.
>> 
>> Maybe these old methods don't need to be synchronized, if this all gets done 
>> at startup in PlatformMBeanProviderImpl init(), the mbeans will always be 
>> created once.
>
> The older code pre-dates unmodifiable maps (JEP 269), it could be modernized 
> some time.

Thanks yes would be good to do that some time.
It looks like an effort with the older accesors to enforce that they are 
singletons.  That may not be important for all the mxbeans.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2564893489

Reply via email to