On Wed, 26 Nov 2025 12:01:40 GMT, Kevin Walls <[email protected]> wrote:
>> I don't see a correctness issue with this. Maybe in the future we will be >> able to use LazyConstant here. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2564793415
