< prev index next >

src/java.management/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java

Print this page




  24  */
  25 
  26 package com.sun.management;
  27 
  28 import javax.management.Notification;
  29 import javax.management.openmbean.CompositeData;
  30 import javax.management.openmbean.CompositeDataView;
  31 import javax.management.openmbean.CompositeType;
  32 import java.util.Collection;
  33 import java.util.Collections;
  34 import sun.management.GarbageCollectionNotifInfoCompositeData;
  35 
  36 /**
  37  * The information about a garbage collection
  38  *
  39  * <p>
  40  * A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
  41  * when the Java virtual machine completes a garbage collection action
  42  * The notification emitted will contain the garbage collection notification
  43  * information about the status of the memory:
  44  * <u1>
  45  *   <li>The name of the garbage collector used to perform the collection.</li>
  46  *   <li>The action performed by the garbage collector.</li>
  47  *   <li>The cause of the garbage collection action.</li>
  48  *   <li>A {@link GcInfo} object containing some statistics about the GC cycle
  49           (start time, end time) and the memory usage before and after
  50           the GC cycle.</li>
  51  * </u1>
  52  *
  53  * <p>
  54  * A {@link CompositeData CompositeData} representing
  55  * the {@code GarbageCollectionNotificationInfo} object
  56  * is stored in the
  57  * {@linkplain javax.management.Notification#setUserData userdata}
  58  * of a {@linkplain javax.management.Notification notification}.
  59  * The {@link #from from} method is provided to convert from
  60  * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo}
  61  * object. For example:
  62  *
  63  * <blockquote><pre>
  64  *      Notification notif;
  65  *
  66  *      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
  67  *      ...
  68  *
  69  *      String notifType = notif.getType();
  70  *      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
  71  *          // retrieve the garbage collection notification information
  72  *          CompositeData cd = (CompositeData) notif.getUserData();
  73  *          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
  74  *          ....
  75  *      }
  76  * </pre></blockquote>
  77  *
  78  * <p>
  79  * The type of the notification emitted by a {@code GarbageCollectorMXBean} is:
  80  * <ul>
  81  *   <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}.
  82  *       <br>Used by every notification emitted by the garbage collector, the details about
  83  *             the notification are provided in the {@linkplain #getGcAction action} String
  84  *       <p></li>
  85  * </ul>
  86  **/
  87 
  88 @jdk.Exported
  89 public class GarbageCollectionNotificationInfo implements  CompositeDataView {
  90 
  91     private final String gcName;
  92     private final String gcAction;
  93     private final String gcCause;
  94     private final GcInfo gcInfo;
  95     private final CompositeData cdata;
  96 
  97     /**
  98      * Notification type denoting that
  99      * the Java virtual machine has completed a garbage collection cycle.
 100      * This notification is emitted by a {@link GarbageCollectorMXBean}.
 101      * The value of this notification type is
 102      * {@code com.sun.management.gc.notification}.
 103      */
 104     public static final String GARBAGE_COLLECTION_NOTIFICATION =




  24  */
  25 
  26 package com.sun.management;
  27 
  28 import javax.management.Notification;
  29 import javax.management.openmbean.CompositeData;
  30 import javax.management.openmbean.CompositeDataView;
  31 import javax.management.openmbean.CompositeType;
  32 import java.util.Collection;
  33 import java.util.Collections;
  34 import sun.management.GarbageCollectionNotifInfoCompositeData;
  35 
  36 /**
  37  * The information about a garbage collection
  38  *
  39  * <p>
  40  * A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
  41  * when the Java virtual machine completes a garbage collection action
  42  * The notification emitted will contain the garbage collection notification
  43  * information about the status of the memory:
  44  * <ul>
  45  *   <li>The name of the garbage collector used to perform the collection.</li>
  46  *   <li>The action performed by the garbage collector.</li>
  47  *   <li>The cause of the garbage collection action.</li>
  48  *   <li>A {@link GcInfo} object containing some statistics about the GC cycle
  49           (start time, end time) and the memory usage before and after
  50           the GC cycle.</li>
  51  * </ul>
  52  *
  53  * <p>
  54  * A {@link CompositeData CompositeData} representing
  55  * the {@code GarbageCollectionNotificationInfo} object
  56  * is stored in the
  57  * {@linkplain javax.management.Notification#setUserData userdata}
  58  * of a {@linkplain javax.management.Notification notification}.
  59  * The {@link #from from} method is provided to convert from
  60  * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo}
  61  * object. For example:
  62  *
  63  * <blockquote><pre>
  64  *      Notification notif;
  65  *
  66  *      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
  67  *      ...
  68  *
  69  *      String notifType = notif.getType();
  70  *      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
  71  *          // retrieve the garbage collection notification information
  72  *          CompositeData cd = (CompositeData) notif.getUserData();
  73  *          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
  74  *          ....
  75  *      }
  76  * </pre></blockquote>
  77  *
  78  * <p>
  79  * The type of the notification emitted by a {@code GarbageCollectorMXBean} is:
  80  * <ul>
  81  *   <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}.
  82  *       <br>Used by every notification emitted by the garbage collector, the details about
  83  *             the notification are provided in the {@linkplain #getGcAction action} String
  84  *       </li>
  85  * </ul>
  86  **/
  87 
  88 @jdk.Exported
  89 public class GarbageCollectionNotificationInfo implements  CompositeDataView {
  90 
  91     private final String gcName;
  92     private final String gcAction;
  93     private final String gcCause;
  94     private final GcInfo gcInfo;
  95     private final CompositeData cdata;
  96 
  97     /**
  98      * Notification type denoting that
  99      * the Java virtual machine has completed a garbage collection cycle.
 100      * This notification is emitted by a {@link GarbageCollectorMXBean}.
 101      * The value of this notification type is
 102      * {@code com.sun.management.gc.notification}.
 103      */
 104     public static final String GARBAGE_COLLECTION_NOTIFICATION =


< prev index next >