< prev index next >

src/share/classes/sun/management/ManagementFactoryHelper.java

Print this page
rev 13428 : jfr backport

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -46,10 +46,13 @@
 import java.util.HashMap;
 import java.util.List;
 import com.sun.management.DiagnosticCommandMBean;
 import com.sun.management.HotSpotDiagnosticMXBean;
 
+import jdk.management.jfr.FlightRecorderMXBean;
+import jdk.management.jfr.FlightRecorderMXBeanImpl;
+
 import static java.lang.management.ManagementFactory.*;
 
 /**
  * ManagementFactoryHelper provides static factory methods to create
  * instances of the management interface.

@@ -63,10 +66,11 @@
     private static MemoryImpl          memoryMBean = null;
     private static ThreadImpl          threadMBean = null;
     private static RuntimeImpl         runtimeMBean = null;
     private static CompilationImpl     compileMBean = null;
     private static OperatingSystemImpl osMBean = null;
+    private static FlightRecorderMXBeanImpl  flightRecorderMBean = null;
 
     public static synchronized ClassLoadingMXBean getClassLoadingMXBean() {
         if (classMBean == null) {
             classMBean = new ClassLoadingImpl(jvm);
         }

@@ -106,10 +110,17 @@
             osMBean = new OperatingSystemImpl(jvm);
         }
         return osMBean;
     }
 
+    public static synchronized FlightRecorderMXBean getFlightRecorderMXBean() {
+        if (flightRecorderMBean == null) {
+            flightRecorderMBean = new FlightRecorderMXBeanImpl();
+        }
+        return flightRecorderMBean;
+    }
+
     public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
         MemoryPoolMXBean[] pools = MemoryImpl.getMemoryPools();
         List<MemoryPoolMXBean> list = new ArrayList<>(pools.length);
         for (MemoryPoolMXBean p : pools) {
             list.add(p);
< prev index next >