This patch contains the final two beans and their VM interfaces.
These may still change slightly as I begin to implement them for GCJ.

Changelog:

2006-07-05  Andrew John Hughes  <[EMAIL PROTECTED]>

        * NEWS: Updated.
        * doc/vmintegration.texinfo: Likewise.
        * examples/gnu/classpath/examples/management/TestGarbageCollector.java,
        * examples/gnu/classpath/examples/management/TestMemoryManager.java,
        * gnu/java/lang/management/GarbageCollectorMXBeanImpl.java,
        * gnu/java/lang/management/MemoryManagerMXBeanImpl.java,
        * java/lang/management/GarbageCollectorMXBean.java:
        New files.
        * java/lang/management/ManagementFactory.java:
        (getGarbageCollectorMXBeans()): Implemented.
        (getMemoryManagerMXBeans()): Likewise.
        * 
vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
        * vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java:
        New files.
        * vm/reference/java/lang/management/VMManagementFactory.java:
        (getMemoryManagerNames()): Added.
        (getGarbageCollectorNames()): Added.

-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: NEWS
===================================================================
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.157
diff -u -3 -p -u -r1.157 NEWS
--- NEWS        4 Jul 2006 21:37:55 -0000       1.157
+++ NEWS        5 Jul 2006 21:34:53 -0000
@@ -75,6 +75,12 @@ Runtime interface changes:
 * VMManagementFactory provides the names of the memory pools,
   memory managers and garbage collectors maintained by the virtual
   machine.  These are used to create the beans by the ManagementFactory.
+* VMMemoryManagerMXBeanImpl and VMGarbageCollectorMXBeanImpl provide
+  low-level support for memory managers (including the specific subclass
+  of garbage collecting memory managers).  The interfaces for these
+  require no more than enumerating the number of collections and the
+  time spent (for garbage collectors) and a relationship to the memory
+  pools (for all), along with a validity check.
 
 New in release 0.91 (May 15, 2006)
 
Index: doc/vmintegration.texinfo
===================================================================
RCS file: /cvsroot/classpath/classpath/doc/vmintegration.texinfo,v
retrieving revision 1.34
diff -u -3 -p -u -r1.34 vmintegration.texinfo
--- doc/vmintegration.texinfo   4 Jul 2006 21:37:55 -0000       1.34
+++ doc/vmintegration.texinfo   5 Jul 2006 21:34:53 -0000
@@ -1276,6 +1276,8 @@ implementations of the management beans.
 * gnu.java.lang.management.VMMemoryMXBeanImpl::
 * gnu.java.lang.management.VMCompilationMXBeanImpl::
 * gnu.java.lang.management.VMMemoryPoolMXBeanImpl::
+* gnu.java.lang.management.VMMemoryManagerMXBeanImpl::
+* gnu.java.lang.management.VMGarbageCollectorMXBeanImpl::
 @end menu
 
 @node 
gnu.java.lang.management.VMRuntimeMXBeanImpl,gnu.java.lang.management.VMClassLoadingMXBeanImpl,,gnu.java.lang.management
@@ -1505,7 +1507,7 @@ Time support is implemented by the follo
 number of milliseconds the JIT compiler has spent compiling.
 @end itemize
 
[EMAIL PROTECTED] 
gnu.java.lang.management.VMMemoryPoolMXBeanImpl,,gnu.java.lang.management.VMCompilationMXBeanImpl,gnu.java.lang.management
[EMAIL PROTECTED] 
gnu.java.lang.management.VMMemoryPoolMXBeanImpl,gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management.VMCompilationMXBeanImpl,gnu.java.lang.management
 @subsection @code{gnu.java.lang.management.VMMemoryPoolMXBeanImpl}
 
 The @code{gnu.java.lang.management.MemoryPoolMXBeanImpl} provides an
@@ -1566,6 +1568,46 @@ the pool's collection usage threshold, i
 the pool's usage threshold, if supported.
 @end itemize
 
[EMAIL PROTECTED] 
gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management.VMGarbageCollectorMXBeanImpl,gnu.java.lang.management.VMMemoryPoolMXBeanImpl,gnu.java.lang.management
[EMAIL PROTECTED] @code{gnu.java.lang.management.VMMemoryManagerMXBeanImpl}
+
+The @code{gnu.java.lang.management.MemoryManagerMXBeanImpl} provides an
+implementation of the optional @code{java.lang.management.MemoryManagerMXBean}
+interface, and is supported by VM functionality in the form of
[EMAIL PROTECTED]  Providing
+this interface requires implementing two methods (each takes the name
+of the manager as the first argument):
+
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED] @code{(getMemoryPoolNames(String))} -- Returns a list of the
+memory pools that the manager maintains.  A default implementation
+which scans the results of @code{getMemoryManagerNames()} for each
+pool is provided.
[EMAIL PROTECTED] @code{(isValid(String))} -- Returns true if the specified
+manager is still valid i.e. it is still in use by the virtual machine.
[EMAIL PROTECTED] itemize
+
[EMAIL PROTECTED] 
gnu.java.lang.management.VMGarbageCollectorMXBeanImpl,,gnu.java.lang.management.VMMemoryManagerMXBeanImpl,gnu.java.lang.management
[EMAIL PROTECTED] @code{gnu.java.lang.management.VMGarbageCollectorMXBeanImpl}
+
+The @code{gnu.java.lang.management.GarbageCollectorMXBeanImpl} provides an
+implementation of the optional 
@code{java.lang.management.GarbageCollectorMXBean}
+interface, and is supported by VM functionality in the form of
[EMAIL PROTECTED]  Providing
+this interface requires implementing two methods (each takes the name
+of the garbage collector as the first argument):
+
[EMAIL PROTECTED] @bullet
[EMAIL PROTECTED] @code{(getCollectionCount(String))} -- Returns the number of
+times the specified garbage collector has run.
[EMAIL PROTECTED] @code{(getCollectionTime(String))} -- Returns the accumulated
+number of milliseconds for which the garbage collector has run.
[EMAIL PROTECTED] itemize
+
+Note that each garbage collector is also a memory manager, and so an
+implementation of the @xref{gnu.java.lang.management.VMMemoryManagerMXBeanImpl}
+methods for its name should also be provided.
+
 @node java.lang.management, Classpath Callbacks, gnu.java.lang.management, 
Classpath Hooks
 @section @code{java.lang.management}
 
@@ -1588,6 +1630,11 @@ The methods are as follows:
 @itemize @bullet
 @item @code{(getMemoryPoolNames())} -- Returns a list of the names
 of the current memory pools in use by the virtual machine.
[EMAIL PROTECTED] @code{(getMemoryManagerNames())} -- Returns a list of the 
names
+of the current memory managers in use by the virtual machine.  This
+should not include those that are also garbage collectors.
[EMAIL PROTECTED] @code{(getGarbageCollectorNames())} -- Returns a list of the 
names
+of the current garbage collectors in use by the virtual machine.
 @end itemize
 
 @node Classpath Callbacks, , java.lang.management, Classpath Hooks
Index: examples/gnu/classpath/examples/management/TestGarbageCollector.java
===================================================================
RCS file: examples/gnu/classpath/examples/management/TestGarbageCollector.java
diff -N examples/gnu/classpath/examples/management/TestGarbageCollector.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ examples/gnu/classpath/examples/management/TestGarbageCollector.java        
5 Jul 2006 21:34:53 -0000
@@ -0,0 +1,53 @@
+/* TestGarbageCollector.java -- Tests the garbage collector beans.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class TestGarbageCollector
+{
+
+  public static void main(String[] args)
+  {
+    Iterator beans = ManagementFactory.getGarbageCollectorMXBeans().iterator();
+    while (beans.hasNext())
+      {
+       GarbageCollectorMXBean bean = (GarbageCollectorMXBean) beans.next();
+       System.out.println("Bean: " + bean);
+       System.out.println("Name: " + bean.getName());
+       System.out.println("Memory pool names: " 
+                          + Arrays.toString(bean.getMemoryPoolNames()));
+       System.out.println("Is valid: " 
+                          + (bean.isValid() ? "yes" : "no"));
+       System.out.println("Collection count: " 
+                          + bean.getCollectionCount());
+       System.out.println("Collection time: " 
+                          + bean.getCollectionTime() + "ms");
+      }
+  }
+}
+
+
+
Index: examples/gnu/classpath/examples/management/TestMemoryManager.java
===================================================================
RCS file: examples/gnu/classpath/examples/management/TestMemoryManager.java
diff -N examples/gnu/classpath/examples/management/TestMemoryManager.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ examples/gnu/classpath/examples/management/TestMemoryManager.java   5 Jul 
2006 21:34:53 -0000
@@ -0,0 +1,49 @@
+/* TestMemoryManager.java -- Tests the memory manager beans.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryManagerMXBean;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class TestMemoryManager
+{
+
+  public static void main(String[] args)
+  {
+    Iterator beans = ManagementFactory.getMemoryManagerMXBeans().iterator();
+    while (beans.hasNext())
+      {
+       MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
+       System.out.println("Bean: " + bean);
+       System.out.println("Name: " + bean.getName());
+       System.out.println("Memory pool names: " 
+                          + Arrays.toString(bean.getMemoryPoolNames()));
+       System.out.println("Is valid: " 
+                          + (bean.isValid() ? "yes" : "no"));
+      }
+  }
+}
+
+
+
Index: gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
===================================================================
RCS file: gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
diff -N gnu/java/lang/management/GarbageCollectorMXBeanImpl.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnu/java/lang/management/GarbageCollectorMXBeanImpl.java    5 Jul 2006 
21:34:54 -0000
@@ -0,0 +1,77 @@
+/* GarbageCollectorMXBeanImpl.java - Implementation of a GC bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.GarbageCollectorMXBean;
+
+/**
+ * Provides access to information about one of the garbage 
+ * collectors used by the current invocation of the
+ * virtual machine.  An instance of this bean for each garbage
+ * collector is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getGarbageCollectorMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+public final class GarbageCollectorMXBeanImpl
+  extends MemoryManagerMXBeanImpl
+  implements GarbageCollectorMXBean
+{
+
+  /**
+   * Constructs a new <code>GarbageCollectorMXBeanImpl</code>.
+   *
+   * @param name the name of the garbage collector this bean represents.
+   */
+  public GarbageCollectorMXBeanImpl(String name)
+  {
+    super(name);
+  }
+
+  public long getCollectionCount()
+  {
+    return VMGarbageCollectorMXBeanImpl.getCollectionCount(name);
+  }
+
+  public long getCollectionTime()
+  {
+    return VMGarbageCollectorMXBeanImpl.getCollectionTime(name);
+  }
+
+}
Index: gnu/java/lang/management/MemoryManagerMXBeanImpl.java
===================================================================
RCS file: gnu/java/lang/management/MemoryManagerMXBeanImpl.java
diff -N gnu/java/lang/management/MemoryManagerMXBeanImpl.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnu/java/lang/management/MemoryManagerMXBeanImpl.java       5 Jul 2006 
21:34:54 -0000
@@ -0,0 +1,87 @@
+/* MemoryManagerMXBeanImpl.java - Implementation of a memory manager bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.MemoryManagerMXBean;
+
+/**
+ * Provides access to information about one of the memory 
+ * managers used by the current invocation of the
+ * virtual machine.  An instance of this bean for each memory
+ * manager is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getMemoryPoolMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+public class MemoryManagerMXBeanImpl
+  extends BeanImpl
+  implements MemoryManagerMXBean
+{
+
+  /**
+   * The name of the memory manager.
+   */
+  protected String name;
+
+  /**
+   * Constructs a new <code>MemoryManagerMXBeanImpl</code>.
+   *
+   * @param name the name of the manager this bean represents.
+   */
+  public MemoryManagerMXBeanImpl(String name)
+  {
+    this.name = name;
+  }
+
+  public String[] getMemoryPoolNames()
+  {
+    return VMMemoryManagerMXBeanImpl.getMemoryPoolNames(name);
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public boolean isValid()
+  {
+    return VMMemoryManagerMXBeanImpl.isValid(name);
+  }
+
+}
Index: java/lang/management/GarbageCollectorMXBean.java
===================================================================
RCS file: java/lang/management/GarbageCollectorMXBean.java
diff -N java/lang/management/GarbageCollectorMXBean.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/management/GarbageCollectorMXBean.java    5 Jul 2006 21:34:54 
-0000
@@ -0,0 +1,79 @@
+/* GarbageCollectorMXBean.java - Interface for a garbage collector bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.management;
+
+/**
+ * Provides access to information about the garbage collectors
+ * of the virtual machine.  Garbage collectors are responsible
+ * for removing unreferenced objects from memory.  A garbage
+ * collector is a type of memory manager, so this interface
+ * is combined with that of generic memory managers.  An instance
+ * of this bean for each garbage collector is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getGarbageCollectorMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+public interface GarbageCollectorMXBean
+  extends MemoryManagerMXBean
+{
+
+  /**
+   * Returns the number of collections the garbage collector
+   * represented by this bean has made.  -1 is returned if the
+   * collection count is undefined.
+   *
+   * @return the number of collections made, or -1 if this is
+   *         undefined.
+   */
+  long getCollectionCount();
+
+  /**
+   * Returns the accumulated number of milliseconds this garbage
+   * collector has spent freeing the memory used by unreferenced
+   * objects.  -1 is returned if the collection time is undefined.
+   * Note that the accumulated time may not change, even when the
+   * collection count increases, if the time taken is sufficiently
+   * short; this depends on the resolution of the timer used.
+   * 
+   * @return the accumulated number of milliseconds spent collecting,
+   *         or -1 if this is undefined.
+   */
+  long getCollectionTime();
+
+}
Index: java/lang/management/ManagementFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/java/lang/management/ManagementFactory.java,v
retrieving revision 1.9
diff -u -3 -p -u -r1.9 ManagementFactory.java
--- java/lang/management/ManagementFactory.java 4 Jul 2006 21:37:55 -0000       
1.9
+++ java/lang/management/ManagementFactory.java 5 Jul 2006 21:34:54 -0000
@@ -41,8 +41,10 @@ import gnu.classpath.SystemProperties;
 
 import gnu.java.lang.management.ClassLoadingMXBeanImpl;
 import gnu.java.lang.management.CompilationMXBeanImpl;
+import gnu.java.lang.management.GarbageCollectorMXBeanImpl;
 import gnu.java.lang.management.OperatingSystemMXBeanImpl;
 import gnu.java.lang.management.MemoryMXBeanImpl;
+import gnu.java.lang.management.MemoryManagerMXBeanImpl;
 import gnu.java.lang.management.MemoryPoolMXBeanImpl;
 import gnu.java.lang.management.RuntimeMXBeanImpl;
 import gnu.java.lang.management.ThreadMXBeanImpl;
@@ -208,4 +210,38 @@ public class ManagementFactory
       poolBeans.add(new MemoryPoolMXBeanImpl(names[a]));
     return poolBeans;
   }
+
+  /**
+   * Returns the memory manager beans for the running
+   * virtual machine.  These may change during the course
+   * of execution.
+   *
+   * @return a list of memory manager beans, one for each manager.
+   */
+  public static List getMemoryManagerMXBeans()
+  {
+    List managerBeans = new ArrayList();
+    String[] names = VMManagementFactory.getMemoryManagerNames();
+    for (int a = 0; a < names.length; ++a)
+      managerBeans.add(new MemoryManagerMXBeanImpl(names[a]));
+    managerBeans.add(getGarbageCollectorMXBeans());
+    return managerBeans;
+  }
+
+  /**
+   * Returns the garbage collector beans for the running
+   * virtual machine.  These may change during the course
+   * of execution.
+   *
+   * @return a list of garbage collector beans, one for each pool.
+   */
+  public static List getGarbageCollectorMXBeans()
+  {
+    List gcBeans = new ArrayList();
+    String[] names = VMManagementFactory.getGarbageCollectorNames();
+    for (int a = 0; a < names.length; ++a)
+      gcBeans.add(new GarbageCollectorMXBeanImpl(names[a]));
+    return gcBeans;
+  }
+
 }
Index: java/lang/management/MemoryManagerMXBean.java
===================================================================
RCS file: java/lang/management/MemoryManagerMXBean.java
diff -N java/lang/management/MemoryManagerMXBean.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/lang/management/MemoryManagerMXBean.java       5 Jul 2006 21:34:54 
-0000
@@ -0,0 +1,77 @@
+/* MemoryManagerMXBean.java - Interface for a memory manager bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.management;
+
+/**
+ * Provides access to information about the memory managers
+ * of the virtual machine.  An instance of this bean for each
+ * memory manager is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getMemoryManagerMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+public interface MemoryManagerMXBean
+{
+
+  /** 
+   * Returns an array containing the names of the memory pools
+   * this memory manager manages.
+   * 
+   * @return an array containing the name of each memory pool
+   *         this manager is responsible for.
+   */
+  String[] getMemoryPoolNames();
+
+  /**
+   * Returns the name of the memory manager.
+   *
+   * @return the memory manager name.
+   */
+  String getName();
+
+  /**
+   * Returns true if this memory manager is still valid.  A memory
+   * manager becomes invalid when it is removed by the virtual machine
+   * and no longer used.
+   *
+   * @return true if this memory manager is valid.
+   */
+  boolean isValid();
+
+}
Index: vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java
===================================================================
RCS file: 
vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java
diff -N vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ vm/reference/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java     
5 Jul 2006 21:34:55 -0000
@@ -0,0 +1,80 @@
+/* VMGarbageCollectorMXBeanImpl.java - VM interface for a GC bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+/**
+ * Provides access to information about the garbage collectors
+ * of the virtual machine.  Garbage collectors are responsible
+ * for removing unreferenced objects from memory.  A garbage
+ * collector is a type of memory manager, so this interface
+ * is combined with that of generic memory managers.  An instance
+ * of this bean for each garbage collector is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getGarbageCollectorMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+final class VMGarbageCollectorMXBeanImpl
+{
+
+  /**
+   * Returns the number of collections the garbage collector
+   * represented by this bean has made.  -1 is returned if the
+   * collection count is undefined.
+   *
+   * @param name the name of the garbage collector.
+   * @return the number of collections made, or -1 if this is
+   *         undefined.
+   */
+  static native long getCollectionCount(String name);
+
+  /**
+   * Returns the accumulated number of milliseconds this garbage
+   * collector has spent freeing the memory used by unreferenced
+   * objects.  -1 is returned if the collection time is undefined.
+   * Note that the accumulated time may not change, even when the
+   * collection count increases, if the time taken is sufficiently
+   * short; this depends on the resolution of the timer used.
+   * 
+   * @param name the name of the garbage collector.
+   * @return the accumulated number of milliseconds spent collecting,
+   *         or -1 if this is undefined.
+   */
+  static native long getCollectionTime(String name);
+
+}
Index: vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java
===================================================================
RCS file: vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java
diff -N vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ vm/reference/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java        
5 Jul 2006 21:34:55 -0000
@@ -0,0 +1,95 @@
+/* VMMemoryManagerMXBeanImpl.java - VM interface for a memory manager bean
+   Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Provides access to information about the memory managers
+ * of the virtual machine.  An instance of this bean for each
+ * memory manager is obtained by calling
+ * [EMAIL PROTECTED] ManagementFactory#getMemoryManagerMXBeans()}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.5
+ */
+final class VMMemoryManagerMXBeanImpl
+{
+
+  /** 
+   * Returns an array containing the names of the memory pools
+   * this memory manager manages.
+   * 
+   * @param name the name of the memory manager.
+   * @return an array containing the name of each memory pool
+   *         this manager is responsible for.
+   */
+  static String[] getMemoryPoolNames(String name)
+  {
+    List managedPools = new ArrayList();
+    Iterator beans = ManagementFactory.getMemoryPoolMXBeans().iterator();
+    while (beans.hasNext())
+      {
+       MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next();
+       String[] managers = bean.getMemoryManagerNames();
+       for (int a = 0; a < managers.length; ++a)
+         if (managers[a].equals(name))
+           {
+             managedPools.add(bean.getName());
+             break;
+           }
+      }
+    return (String[]) managedPools.toArray(new String[managedPools.size()]);
+  }
+
+  /**
+   * Returns true if this memory manager is still valid.  A memory
+   * manager becomes invalid when it is removed by the virtual machine
+   * and no longer used.
+   *
+   * @param name the name of the memory manager.
+   * @return true if this memory manager is valid.
+   */
+  static native boolean isValid(String name);
+
+}
Index: vm/reference/java/lang/management/VMManagementFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/vm/reference/java/lang/management/VMManagementFactory.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 VMManagementFactory.java
--- vm/reference/java/lang/management/VMManagementFactory.java  4 Jul 2006 
21:37:55 -0000       1.1
+++ vm/reference/java/lang/management/VMManagementFactory.java  5 Jul 2006 
21:34:55 -0000
@@ -56,4 +56,20 @@ final class VMManagementFactory
    */
   static native String[] getMemoryPoolNames();
 
+  /**
+   * Return a list of the names of the currently available
+   * memory managers within the virtual machine.  This should
+   * not include the garbage collectors listed below.
+   *
+   * @return a list of memory manager names.
+   */
+  static native String[] getMemoryManagerNames();
+
+  /**
+   * Return a list of the names of the currently available
+   * garbage collectors within the virtual machine.
+   *
+   * @return a list of garbage collector names.
+   */
+  static native String[] getGarbageCollectorNames();
 }

Attachment: signature.asc
Description: Digital signature

Reply via email to