APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.management

public Class GarbageCollectionNotificationInfo

extends Object
implements CompositeDataView
Class Inheritance
All Implemented Interfaces
javax.management.openmbean.CompositeDataView
Imports
javax.management.openmbean.CompositeData, .CompositeDataView, .CompositeType, com.sun.management.internal.GarbageCollectionNotifInfoCompositeData

The information about a garbage collection

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:

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:

Since
1.7

Field Summary

Modifier and TypeField and Description
private final CompositeData
public static final String
GARBAGE_COLLECTION_NOTIFICATION

Notification type denoting that the Java virtual machine has completed a garbage collection cycle.

private final String
private final String
private final GcInfo
private final String

Constructor Summary

AccessConstructor and Description
public
GarbageCollectionNotificationInfo(String
The name of the garbage collector used to perform the collection
gcName
,
String
The name of the action performed by the garbage collector
gcAction
,
String
The cause of the garbage collection action
gcCause
,
GcInfo
a GcInfo object providing statistics about the GC cycle
gcInfo
)

Constructs a GarbageCollectionNotificationInfo object.

pack-priv

Method Summary

Modifier and TypeMethod and Description
public static GarbageCollectionNotificationInfo

Returns:

a GarbageCollectionNotificationInfo object represented by cd if cd is not null; null otherwise.
from
(CompositeData
CompositeData representing a GarbageCollectionNotificationInfo
cd
)

Returns a GarbageCollectionNotificationInfo object represented by the given CompositeData.

public String

Returns:

the action performed by the garbage collector
getGcAction
()

Returns the action performed by the garbage collector

public String

Returns:

the cause of the garbage collection
getGcCause
()

Returns the cause of the garbage collection

public GcInfo

Returns:

the GC information related to the last garbage collection
getGcInfo
()

Returns the GC information related to the last garbage collection

public String

Returns:

the name of the garbage collector used to perform the collection
getGcName
()

Returns the name of the garbage collector used to perform the collection

public CompositeData
toCompositeData(CompositeType ct)

Implements javax.management.openmbean.CompositeDataView.toCompositeData.

Return a CompositeData corresponding to the values in this object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cdataback to summary
private final CompositeData cdata
GARBAGE_COLLECTION_NOTIFICATIONback to summary
public static final String GARBAGE_COLLECTION_NOTIFICATION

Notification type denoting that the Java virtual machine has completed a garbage collection cycle. This notification is emitted by a GarbageCollectorMXBean. The value of this notification type is com.sun.management.gc.notification.

gcActionback to summary
private final String gcAction
gcCauseback to summary
private final String gcCause
gcInfoback to summary
private final GcInfo gcInfo
gcNameback to summary
private final String gcName

Constructor Detail

GarbageCollectionNotificationInfoback to summary
public GarbageCollectionNotificationInfo(String gcName, String gcAction, String gcCause, GcInfo gcInfo)

Constructs a GarbageCollectionNotificationInfo object.

Parameters
gcName:String

The name of the garbage collector used to perform the collection

gcAction:String

The name of the action performed by the garbage collector

gcCause:String

The cause of the garbage collection action

gcInfo:GcInfo

a GcInfo object providing statistics about the GC cycle

GarbageCollectionNotificationInfoback to summary
pack-priv GarbageCollectionNotificationInfo(CompositeData cd)

Method Detail

fromback to summary
public static GarbageCollectionNotificationInfo from(CompositeData cd)

Returns a GarbageCollectionNotificationInfo object represented by the given CompositeData. The given CompositeData must contain the following attributes:

description
Attribute Name Type
gcName java.lang.String
gcAction java.lang.String
gcCause java.lang.String
gcInfo javax.management.openmbean.CompositeData
Parameters
cd:CompositeData

CompositeData representing a GarbageCollectionNotificationInfo

Returns:GarbageCollectionNotificationInfo

a GarbageCollectionNotificationInfo object represented by cd if cd is not null; null otherwise.

Exceptions
IllegalArgumentException:
if cd does not represent a GarbaageCollectionNotificationInfo object.
getGcActionback to summary
public String getGcAction()

Returns the action performed by the garbage collector

Returns:String

the action performed by the garbage collector

getGcCauseback to summary
public String getGcCause()

Returns the cause of the garbage collection

Returns:String

the cause of the garbage collection

getGcInfoback to summary
public GcInfo getGcInfo()

Returns the GC information related to the last garbage collection

Returns:GcInfo

the GC information related to the last garbage collection

getGcNameback to summary
public String getGcName()

Returns the name of the garbage collector used to perform the collection

Returns:String

the name of the garbage collector used to perform the collection

toCompositeDataback to summary
public CompositeData toCompositeData(CompositeType ct)

Implements javax.management.openmbean.CompositeDataView.toCompositeData.

Doc from javax.management.openmbean.CompositeDataView.toCompositeData.

Return a CompositeData corresponding to the values in this object. The returned value should usually be an instance of CompositeDataSupport, or a class that serializes as a CompositeDataSupport via a writeReplace method. Otherwise, a remote client that receives the object might not be able to reconstruct it.