This adds documentation for the new notification support.

Changelog:

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

        * doc/vmintegration.texinfo:
        Mention callback methods.
        * gnu/java/lang/management/MemoryMXBeanImpl.java:
        (fireNotification(String,String,long,long,long,long,long)):
        Made package-private.
        (fireThresholdExceededNotification(String,long,long,long,
        long,long)): Likewise.
        (fireCollectionThresholdExceededNotification(String,long,
        long,long,long,long)): Likewise.
        * java/lang/management/MemoryMXBean.java:
        Document notifications.

-- 
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.37
diff -u -3 -p -u -r1.37 vmintegration.texinfo
--- doc/vmintegration.texinfo   15 Jul 2006 20:22:50 -0000      1.37
+++ doc/vmintegration.texinfo   22 Jul 2006 13:14:49 -0000
@@ -1651,6 +1651,25 @@ the group.
 Call this method from @code{Thread} when a @code{Thread} is stopped or 
destroyed.
 @end itemize
 
[EMAIL PROTECTED] 
@code{gnu.java.lang.management.MemoryMXBeanImpl.fireThresholdExceededNotification(String,
 long, long, long, long)}
+If the monitoring of memory usage thresholds is supported, this method
+should be called when the normal usage of a memory pool crosses the
+threshold, in order to emit a notification.  Another notification
+should not be emitted until there is an intermittent period where the
+usage is again below the threshold.  The parameters are the memory
+pool name, the usage levels (init, used, committed and max) and the
+number of times the threshold has been crossed.
+
[EMAIL PROTECTED] 
@code{gnu.java.lang.management.MemoryMXBeanImpl.fireCollectionThresholdExceededNotification(String,
 long, long, long, long)}
+If the monitoring of memory usage thresholds is supported, this method
+should be called when the usage of a memory pool after a garbage
+collection cycle crosses the threshold, in order to emit a
+notification.  Another notification should not be emitted until there
+is an intermittent period where the usage is again below the
+threshold.  The parameters are the memory pool name, the usage levels
+(init, used, committed and max) and the number of times the threshold
+has been crossed.
+
 @node VM Hooks, JNI Implementation, Classpath Hooks, Top
 @comment node-name, next, previous, up
 @chapter VM Hooks
Index: gnu/java/lang/management/MemoryMXBeanImpl.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/lang/management/MemoryMXBeanImpl.java,v
retrieving revision 1.3
diff -u -3 -p -u -r1.3 MemoryMXBeanImpl.java
--- gnu/java/lang/management/MemoryMXBeanImpl.java      22 Jul 2006 11:11:36 
-0000      1.3
+++ gnu/java/lang/management/MemoryMXBeanImpl.java      22 Jul 2006 13:14:49 
-0000
@@ -257,8 +257,8 @@ public final class MemoryMXBeanImpl
       }
   }
 
-  public void fireNotification(String type, String poolName, long init, long 
used,
-                              long committed, long max, long count)
+  void fireNotification(String type, String poolName, long init, long used,
+                       long committed, long max, long count)
   {
     Notification notif = new Notification(type, this, notificationCount);
     MemoryUsage usage = new MemoryUsage(init, used, committed, max);
@@ -290,20 +290,20 @@ public final class MemoryMXBeanImpl
     ++notificationCount;
   }
 
-  public void fireThresholdExceededNotification(String poolName, long init,
-                                               long used, long committed,
-                                               long max, long count)
+  void fireThresholdExceededNotification(String poolName, long init,
+                                        long used, long committed,
+                                        long max, long count)
   {
     fireNotification(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED,
                     poolName, init, used, committed, max, count);
   }
 
-  public void fireCollectionThresholdExceededNotification(String poolName,
-                                                         long init,
-                                                         long used,
-                                                         long committed,
-                                                         long max,
-                                                         long count)
+  void fireCollectionThresholdExceededNotification(String poolName,
+                                                  long init,
+                                                  long used,
+                                                  long committed,
+                                                  long max,
+                                                  long count)
   {
     
fireNotification(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED,
                     poolName, init, used, committed, max, count);
Index: java/lang/management/MemoryMXBean.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/management/MemoryMXBean.java,v
retrieving revision 1.1
diff -u -3 -p -u -r1.1 MemoryMXBean.java
--- java/lang/management/MemoryMXBean.java      2 Jul 2006 17:29:10 -0000       
1.1
+++ java/lang/management/MemoryMXBean.java      22 Jul 2006 13:14:50 -0000
@@ -70,6 +70,34 @@ package java.lang.management;
  * either change (either expanding or contracting) or stay
  * the same.
  * </p>
+ * <h2>Notifications</h2>
+ * <p>
+ * Implementations of this interface also conform to the
+ * [EMAIL PROTECTED] javax.management.NotificationEmitter} interface,
+ * and supply two notifications reflecting memory usage.
+ * These notifications occur when a usage threshold is
+ * exceeded; for more details of these, see the documentation
+ * of [EMAIL PROTECTED] MemoryPoolMXBean}.  If threshold monitoring
+ * is supported, then a notification will be emitted each time
+ * the threshold is crossed.  Another notification will not
+ * be emitted unless the usage level has dropped below the
+ * threshold again in the meantime.
+ * </p>
+ * <p>
+ * The emitted notifications are instances of
+ * [EMAIL PROTECTED] javax.management.Notification}, with a type of
+ * either
+ * [EMAIL PROTECTED] 
java.lang.management.MemoryNotificationInfo#MEMORY_THRESHOLD_EXCEEDED}
+ * or
+ * [EMAIL PROTECTED] 
java.lang.management.MemoryNotificationInfo#MEMORY_COLLECTION_THRESHOLD_EXCEEDED}
+ * (depending on whether the notification refers to the general
+ * usage threshold or the garbage collection threshold) and an instance
+ * of [EMAIL PROTECTED] java.lang.management.MemoryNotificationInfo} contained
+ * in the user data section.  This is wrapped inside an instance
+ * of [EMAIL PROTECTED] javax.management.openmbean.CompositeData}, as explained
+ * in the documentation for
+ * [EMAIL PROTECTED] java.lang.management.MemoryNotificationInfo}.
+ * </p>
  *
  * @author Andrew John Hughes ([EMAIL PROTECTED])
  * @since 1.5

Attachment: signature.asc
Description: Digital signature

Reply via email to