diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-07-02 21:43:13 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-07-02 21:43:13 +0000 |
commit | a07c56d504ec51366a32f696d20e779b1bac79e6 (patch) | |
tree | 0554dd033ff9df1af55154f236b975c2c273fd55 /java/lang/management/ManagementFactory.java | |
parent | 3b00aa20227be4b0f2314278dcea3ef3739c44aa (diff) | |
download | classpath-a07c56d504ec51366a32f696d20e779b1bac79e6.tar.gz |
2006-07-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD --> generics-branch for
2006/06/27 to 2006/07/02.
Diffstat (limited to 'java/lang/management/ManagementFactory.java')
-rw-r--r-- | java/lang/management/ManagementFactory.java | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/java/lang/management/ManagementFactory.java b/java/lang/management/ManagementFactory.java index 5f99bbe1d..6e8010089 100644 --- a/java/lang/management/ManagementFactory.java +++ b/java/lang/management/ManagementFactory.java @@ -37,11 +37,14 @@ exception statement from your version. */ package java.lang.management; -import gnu.classpath.NotImplementedException; +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; +import gnu.java.lang.management.ThreadMXBeanImpl; /** * <p> @@ -79,6 +82,21 @@ public class ManagementFactory private static ClassLoadingMXBean classLoadingBean; /** + * The thread bean. + */ + private static ThreadMXBean threadBean; + + /** + * The memory bean. + */ + private static MemoryMXBean memoryBean; + + /** + * The compilation bean (may remain null). + */ + private static CompilationMXBean compilationBean; + + /** * Private constructor to prevent instance creation. */ private ManagementFactory() {} @@ -133,9 +151,42 @@ public class ManagementFactory * this virtual machine. */ public static ThreadMXBean getThreadMXBean() - throws NotImplementedException { - return null; + if (threadBean == null) + threadBean = new ThreadMXBeanImpl(); + return threadBean; + } + + /** + * Returns the memory management bean for the running + * virtual machine. + * + * @return an instance of {@link MemoryMXBean} for + * this virtual machine. + */ + public static MemoryMXBean getMemoryMXBean() + { + if (memoryBean == null) + memoryBean = new MemoryMXBeanImpl(); + 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; } } |