< prev index next >

src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java

Print this page
*** 158,43 ***
                          threadMBean);
              }
          });
  
          /**
!          * VirtualThreadSchedulerMXBean.
           */
!         initMBeanList.add(new PlatformComponent<VirtualThreadSchedulerMXBean>() {
!             private final Set<Class<? extends VirtualThreadSchedulerMXBean>> mbeanInterfaces =
!                     Set.of(VirtualThreadSchedulerMXBean.class);
!             private final Set<String> mbeanInterfaceNames =
!                     Set.of(VirtualThreadSchedulerMXBean.class.getName());
!             private VirtualThreadSchedulerMXBean impl;
! 
!             @Override
!             public Set<Class<? extends VirtualThreadSchedulerMXBean>> mbeanInterfaces() {
!                 return mbeanInterfaces;
!             }
  
!             @Override
!             public Set<String> mbeanInterfaceNames() {
!                 return mbeanInterfaceNames;
!             }
  
!             @Override
!             public String getObjectNamePattern() {
!                 return "jdk.management:type=VirtualThreadScheduler";
!             }
  
!             @Override
!             public Map<String, VirtualThreadSchedulerMXBean> nameToMBeanMap() {
!                 VirtualThreadSchedulerMXBean impl = this.impl;
!                 if (impl == null) {
!                     this.impl = impl = VirtualThreadSchedulerImpls.create();
                  }
!                 return Map.of("jdk.management:type=VirtualThreadScheduler", impl);
!             }
-         });
  
          /**
           * OperatingSystemMXBean
           */
          initMBeanList.add(new PlatformComponent<OperatingSystemMXBean>() {
--- 158,46 ---
                          threadMBean);
              }
          });
  
          /**
!          * VirtualThreadSchedulerMXBean registered when using JDK's virtual thread scheduler.
           */
!         String value = System.getProperty("jdk.virtualThreadScheduler.implClass");
!         if (value == null) {
!             initMBeanList.add(new PlatformComponent<VirtualThreadSchedulerMXBean>() {
!                 private final Set<Class<? extends VirtualThreadSchedulerMXBean>> mbeanInterfaces =
!                         Set.of(VirtualThreadSchedulerMXBean.class);
!                 private final Set<String> mbeanInterfaceNames =
!                         Set.of(VirtualThreadSchedulerMXBean.class.getName());
!                 private VirtualThreadSchedulerMXBean impl;
! 
!                 @Override
!                 public Set<Class<? extends VirtualThreadSchedulerMXBean>> mbeanInterfaces() {
+                     return mbeanInterfaces;
+                 }
  
!                 @Override
!                 public Set<String> mbeanInterfaceNames() {
!                     return mbeanInterfaceNames;
!                 }
  
!                 @Override
!                 public String getObjectNamePattern() {
!                     return "jdk.management:type=VirtualThreadScheduler";
!                 }
  
!                 @Override
!                 public Map<String, VirtualThreadSchedulerMXBean> nameToMBeanMap() {
!                     VirtualThreadSchedulerMXBean impl = this.impl;
!                     if (impl == null) {
!                         this.impl = impl = VirtualThreadSchedulerImpls.create();
+                     }
+                     return Map.of("jdk.management:type=VirtualThreadScheduler", impl);
                  }
!             });
!         }
  
          /**
           * OperatingSystemMXBean
           */
          initMBeanList.add(new PlatformComponent<OperatingSystemMXBean>() {
< prev index next >