- All Implemented Interfaces:
- CompositeDataView
 A garbage collection notification is emitted by GarbageCollectorMXBean
 when the Java virtual machine completes a garbage collection action
 The notification emitted will contain the garbage collection notification
 information about the status of the memory:
 
- The name of the garbage collector used to perform the collection.
- The action performed by the garbage collector.
- The cause of the garbage collection action.
- A GcInfoobject containing some statistics about the GC cycle (start time, end time) and the memory usage before and after the GC cycle.
 A CompositeData representing
 the GarbageCollectionNotificationInfo object
 is stored in the
 userdata
 of a notification.
 The from method is provided to convert from
 a CompositeData to a GarbageCollectionNotificationInfo
 object. For example:
 
      Notification notif;
      // receive the notification emitted by a GarbageCollectorMXBean and set to notif
      ...
      String notifType = notif.getType();
      if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
          // retrieve the garbage collection notification information
          CompositeData cd = (CompositeData) notif.getUserData();
          GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
          ....
      }
 
 The type of the notification emitted by a GarbageCollectorMXBean is:
 
- A garbage collection notification.
       
 Used by every notification emitted by the garbage collector, the details about the notification are provided in the action String
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringNotification type denoting that the Java virtual machine has completed a garbage collection cycle.
- 
Constructor SummaryConstructorsConstructorDescriptionGarbageCollectionNotificationInfo(String gcName, String gcAction, String gcCause, GcInfo gcInfo) Constructs aGarbageCollectionNotificationInfoobject.
- 
Method SummaryModifier and TypeMethodDescriptionfrom(CompositeData cd) Returns aGarbageCollectionNotificationInfoobject represented by the givenCompositeData.Returns the action performed by the garbage collectorReturns the cause of the garbage collectionReturns the GC information related to the last garbage collectionReturns the name of the garbage collector used to perform the collectionReturn aCompositeDatacorresponding to the values in this object.
- 
Field Details- 
GARBAGE_COLLECTION_NOTIFICATIONNotification type denoting that the Java virtual machine has completed a garbage collection cycle. This notification is emitted by aGarbageCollectorMXBean. The value of this notification type iscom.sun.management.gc.notification.- See Also:
 
 
- 
- 
Constructor Details- 
GarbageCollectionNotificationInfopublic GarbageCollectionNotificationInfo(String gcName, String gcAction, String gcCause, GcInfo gcInfo) Constructs aGarbageCollectionNotificationInfoobject.- Parameters:
- gcName- The name of the garbage collector used to perform the collection
- gcAction- The name of the action performed by the garbage collector
- gcCause- The cause of the garbage collection action
- gcInfo- a GcInfo object providing statistics about the GC cycle
 
 
- 
- 
Method Details- 
getGcNameReturns the name of the garbage collector used to perform the collection- Returns:
- the name of the garbage collector used to perform the collection
 
- 
getGcActionReturns the action performed by the garbage collector- Returns:
- the action performed by the garbage collector
 
- 
getGcCauseReturns the cause of the garbage collection- Returns:
- the cause of the garbage collection
 
- 
getGcInfoReturns the GC information related to the last garbage collection- Returns:
- the GC information related to the last garbage collection
 
- 
fromReturns aGarbageCollectionNotificationInfoobject represented by the givenCompositeData. The givenCompositeDatamust contain the following attributes:Attribute Name Type gcName java.lang.StringgcAction java.lang.StringgcCause java.lang.StringgcInfo javax.management.openmbean.CompositeData- Parameters:
- cd-- CompositeDatarepresenting a- GarbageCollectionNotificationInfo
- Returns:
- a GarbageCollectionNotificationInfoobject represented bycdifcdis notnull;nullotherwise.
- Throws:
- IllegalArgumentException- if- cddoes not represent a- GarbaageCollectionNotificationInfoobject.
 
- 
toCompositeDataDescription copied from interface:CompositeDataViewReturn a CompositeDatacorresponding to the values in this object. The returned value should usually be an instance ofCompositeDataSupport, or a class that serializes as aCompositeDataSupportvia awriteReplacemethod. Otherwise, a remote client that receives the object might not be able to reconstruct it.- Specified by:
- toCompositeDatain interface- CompositeDataView
- Parameters:
- ct- The expected- CompositeTypeof the returned value. If the returned value is- cd, then- cd.getCompositeType().equals(ct)should be true. Typically this will be because- cdis a- CompositeDataSupportconstructed with- ctas its- CompositeType.
- Returns:
- the CompositeData.
 
 
-