diff options
Diffstat (limited to 'java/lang/management/ManagementFactory.java')
| -rw-r--r-- | java/lang/management/ManagementFactory.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/java/lang/management/ManagementFactory.java b/java/lang/management/ManagementFactory.java index 915ca50c1..6e8010089 100644 --- a/java/lang/management/ManagementFactory.java +++ b/java/lang/management/ManagementFactory.java @@ -37,7 +37,10 @@ exception statement from your version. */ package java.lang.management; +import gnu.classpath.SystemProperties; + import gnu.java.lang.management.ClassLoadingMXBeanImpl; +import gnu.java.lang.management.CompilationMXBeanImpl; import gnu.java.lang.management.OperatingSystemMXBeanImpl; import gnu.java.lang.management.MemoryMXBeanImpl; import gnu.java.lang.management.RuntimeMXBeanImpl; @@ -89,6 +92,11 @@ public class ManagementFactory private static MemoryMXBean memoryBean; /** + * The compilation bean (may remain null). + */ + private static CompilationMXBean compilationBean; + + /** * Private constructor to prevent instance creation. */ private ManagementFactory() {} @@ -163,4 +171,22 @@ public class ManagementFactory return memoryBean; } + /** + * Returns the compilation bean for the running + * virtual machine, if supported. Otherwise, + * it returns <code>null</code>. + * + * @return an instance of {@link CompilationMXBean} for + * this virtual machine, or <code>null</code> + * if the virtual machine doesn't include + * a Just-In-Time (JIT) compiler. + */ + public static CompilationMXBean getCompilationMXBean() + { + if (compilationBean == null && + SystemProperties.getProperty("gnu.java.compiler.name") != null) + compilationBean = new CompilationMXBeanImpl(); + return compilationBean; + } + } |
