This adds the missing method, getType(), to MemoryPoolMXBean. A full implementation requires an enumeration, which I'll add when this is merged to generics. The HEAD version and the VM layer just uses a String.
Changelog:
2006-07-22 Andrew John Hughes <[EMAIL PROTECTED]>
* doc/vmintegration.texinfo:
Document getType(String).
* gnu/java/lang/management/MemoryPoolMXBeanImpl.java,
* java/lang/management/MemoryPoolMXBean.java:
(getType()): Implemented.
* vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java
(getType(String)): Implemented.
--
Andrew :-)
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: doc/vmintegration.texinfo
===================================================================
RCS file: /cvsroot/classpath/classpath/doc/vmintegration.texinfo,v
retrieving revision 1.39
diff -u -3 -p -u -r1.39 vmintegration.texinfo
--- doc/vmintegration.texinfo 22 Jul 2006 17:34:58 -0000 1.39
+++ doc/vmintegration.texinfo 22 Jul 2006 19:54:19 -0000
@@ -1551,6 +1551,9 @@ of names of memory managers which manage
@item @code{(getPeakUsage(String))} -- Returns a
@code{java.lang.management.MemoryUsage} object for the peak
usage level of the specified pool.
[EMAIL PROTECTED] @code{(getType(String))} -- Returns a string containing
+either @code{"HEAP"} or @code{"NON_HEAP"} which indicates the type of
+memory used by the specified pool.
@item @code{(getUsage(String))} -- Returns a
@code{java.lang.management.MemoryUsage} object for the current
usage level of the specified pool.
Index: gnu/java/lang/management/MemoryPoolMXBeanImpl.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/lang/management/MemoryPoolMXBeanImpl.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 MemoryPoolMXBeanImpl.java
--- gnu/java/lang/management/MemoryPoolMXBeanImpl.java 4 Jul 2006 21:37:55
-0000 1.1
+++ gnu/java/lang/management/MemoryPoolMXBeanImpl.java 22 Jul 2006 19:54:20
-0000
@@ -125,6 +125,11 @@ public final class MemoryPoolMXBeanImpl
return null;
}
+ public String getType()
+ {
+ return VMMemoryPoolMXBeanImpl.getType(name);
+ }
+
public MemoryUsage getUsage()
{
if (isValid())
Index: java/lang/management/MemoryPoolMXBean.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/lang/management/MemoryPoolMXBean.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 MemoryPoolMXBean.java
--- java/lang/management/MemoryPoolMXBean.java 3 Jul 2006 20:22:15 -0000
1.1
+++ java/lang/management/MemoryPoolMXBean.java 22 Jul 2006 19:54:20 -0000
@@ -157,6 +157,14 @@ public interface MemoryPoolMXBean
MemoryUsage getPeakUsage();
/**
+ * Returns the type of memory used by this pool. This can be
+ * either heap or non-heap memory.
+ *
+ * @return the type of this pool.
+ */
+ String getType();
+
+ /**
* Returns memory usage statistics for the current memory usage
* of the pool. The return value may be <code>null</code> if
* this pool is no longer valid. Obtaining these values is
Index: vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 VMMemoryPoolMXBeanImpl.java
--- vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java 4 Jul
2006 21:37:55 -0000 1.1
+++ vm/reference/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java 22 Jul
2006 19:54:21 -0000
@@ -106,6 +106,15 @@ final class VMMemoryPoolMXBeanImpl
static native MemoryUsage getPeakUsage(String name);
/**
+ * Returns the type of memory used by the specified pool.
+ * The value must be either "HEAP" or "NON_HEAP".
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return the type of the given pool.
+ */
+ static native String getType(String name);
+
+ /**
* Returns the current usage level of the specified pool.
* This is only called if the pool is valid.
*
signature.asc
Description: Digital signature
