public class GarbageCollectionNotificationInfo extends Object implements 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:
GcInfo object 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 save in 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:
| Modifier and Type | Field and Description |
|---|---|
static String |
GARBAGE_COLLECTION_NOTIFICATION
Notification type denoting that the Java virtual machine has completed a garbage collection cycle.
|
| Constructor and Description |
|---|
GarbageCollectionNotificationInfo(String gcName,
String gcAction,
String gcCause,
GcInfo gcInfo)
Creates a new
GarbageCollectionNotificationInfo instance. |
| Modifier and Type | Method and Description |
|---|---|
static GarbageCollectionNotificationInfo |
from(CompositeData cd)
Returns a
GarbageCollectionNotificationInfo object represented by the
given CompositeData. |
String |
getGcAction() |
String |
getGcCause() |
GcInfo |
getGcInfo() |
String |
getGcName() |
CompositeData |
toCompositeData(CompositeType ct)
Return the
CompositeData representation of this
GarbageCollectionNotificationInfo. |
public static final String GARBAGE_COLLECTION_NOTIFICATION
public GarbageCollectionNotificationInfo(String gcName, String gcAction, String gcCause, GcInfo gcInfo)
GarbageCollectionNotificationInfo instance.gcName - the name of the garbage collector used to perform the collectiongcAction - the action of the performed by the garbage collectorgcCause - the cause the garbage collectiongcInfo - a GcInfo object providing statistics about the GC cyclepublic String getGcName()
public String getGcAction()
public String getGcCause()
public GcInfo getGcInfo()
public static GarbageCollectionNotificationInfo from(CompositeData cd)
GarbageCollectionNotificationInfo object represented by the
given CompositeData.
The given CompositeData must contain the following attributes:
| Attribute Name | Type |
|---|---|
| gcName | java.lang.String |
| gcAction | java.lang.String |
| gcCause | java.lang.String |
| gcInfo | com.ibm.lang.management.GcInfo |
cd - CompositeData representing a
GarbageCollectionNotificationInfoGarbageCollectionNotificationInfo object represented
by cd if cd is not null;
null otherwiseIllegalArgumentException - if cd does not
represent a GarbageCollectionNotificationInfo objectpublic CompositeData toCompositeData(CompositeType ct)
Return the CompositeData representation of this
GarbageCollectionNotificationInfo.
toCompositeData in interface CompositeDataViewct - the CompositeType that the caller expects.
This parameter is ignored and can be null.CompositeData representation.Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2001, 2025 IBM Corp. and others.