- java.lang.Object
-
- java.lang.management.MemoryNotificationInfo
-
public class MemoryNotificationInfo extends Object
Encapsulates the details of a memory notification emitted by aMemoryMXBeanwhen a memory pool exceeds a threshold value.If the memory usage of a memory pool increases such that it reaches or exceeds the memory usage threshold, a
MEMORY_THRESHOLD_EXCEEDEDnotification is sent.If, upon the completion of a run of the garbage collector, a memory pool exceeds its collection usage threshold, a
MEMORY_COLLECTION_THRESHOLD_EXCEEDEDnotification is sent.- Since:
- 1.5
-
-
Field Summary
Fields Modifier and Type Field Description static StringMEMORY_COLLECTION_THRESHOLD_EXCEEDEDNotification type that signifies a memory pool's memory usage has grown to reach or exceed the collection usage threshold value set for it after a run of the garbage collector.static StringMEMORY_THRESHOLD_EXCEEDEDNotification type that signifies a memory pool has grown such that it now reaches or exceeds the usage threshold value set for it.
-
Constructor Summary
Constructors Constructor Description MemoryNotificationInfo(String poolName, MemoryUsage usage, long count)Creates a newMemoryNotificationInfoinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MemoryNotificationInfofrom(CompositeData cd)Receives aCompositeDatarepresenting aMemoryNotificationInfoobject and attempts to return the rootMemoryNotificationInfoinstance.longgetCount()Returns the number of times that the memory usage has crossed the threshold relevant to the type of notification when the notification was constructed.StringgetPoolName()Returns the name of the memory pool that the notification relates to.MemoryUsagegetUsage()Returns an instance ofMemoryUsagethat encapsulates the memory usage of the memory pool that gave rise to this notification at the time the notification was created.
-
-
-
Field Detail
-
MEMORY_THRESHOLD_EXCEEDED
public static final String MEMORY_THRESHOLD_EXCEEDED
Notification type that signifies a memory pool has grown such that it now reaches or exceeds the usage threshold value set for it.- See Also:
- Constant Field Values
-
MEMORY_COLLECTION_THRESHOLD_EXCEEDED
public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED
Notification type that signifies a memory pool's memory usage has grown to reach or exceed the collection usage threshold value set for it after a run of the garbage collector.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MemoryNotificationInfo
public MemoryNotificationInfo(String poolName, MemoryUsage usage, long count)
Creates a newMemoryNotificationInfoinstance.- Parameters:
poolName- the name of the memory pool that the notification relates to.usage- the memory usage for the named poolcount- the number of times that the memory usage of the memory pool has met or exceeded the relevant threshold. For notifications of theMEMORY_THRESHOLD_EXCEEDEDtype, this will a count of the number of times the memory usage threshold has been met or exceeded. ForMEMORY_COLLECTION_THRESHOLD_EXCEEDEDnotifications, this will be the number of times that the collection usage threshold was passed.- Throws:
NullPointerException- when poolName or usage is null
-
-
Method Detail
-
getCount
public long getCount()
Returns the number of times that the memory usage has crossed the threshold relevant to the type of notification when the notification was constructed. For notifications of theMEMORY_THRESHOLD_EXCEEDEDtype, this will a count of the number of times the memory usage threshold has been met or exceeded. ForMEMORY_COLLECTION_THRESHOLD_EXCEEDEDnotifications, this will be the number of times that the collection usage threshold was passed.- Returns:
- the number of times the related memory usage was passed at the time of the notification construction.
-
getPoolName
public String getPoolName()
Returns the name of the memory pool that the notification relates to.- Returns:
- the name of the associated memory pool.
-
getUsage
public MemoryUsage getUsage()
Returns an instance ofMemoryUsagethat encapsulates the memory usage of the memory pool that gave rise to this notification at the time the notification was created. TheMemoryUsagemay be interrogated by the caller to find out the details of the memory usage.- Returns:
- the memory usage of the related memory pool at the point when this notification was created.
-
from
public static MemoryNotificationInfo from(CompositeData cd)
Receives aCompositeDatarepresenting aMemoryNotificationInfoobject and attempts to return the rootMemoryNotificationInfoinstance.- Parameters:
cd- aCompositeDatethat represents aMemoryNotificationInfo.- Returns:
- if
cdis non-null, returns a new instance ofMemoryNotificationInfo. Ifcdisnull, returnsnull. - Throws:
IllegalArgumentException- if argumentcddoes not correspond to aMemoryNotificationInfowith the following attributes:poolName(java.lang.String)usage(javax.management.openmbean.CompositeData)count(java.lang.Long)
The
usageattribute must represent aMemoryUsageinstance which encapsulates the memory usage of a memory pool.
-
-