java.lang.Object
java.lang.management.MemoryNotificationInfo
Encapsulates the details of a memory notification emitted by a
MemoryMXBean when 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_EXCEEDED
notification 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_EXCEEDED notification is sent.
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNotification 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 final StringNotification type that signifies a memory pool has grown such that it now reaches or exceeds the usage threshold value set for it. -
Constructor Summary
ConstructorsConstructorDescriptionMemoryNotificationInfo(String poolName, MemoryUsage usage, long count) Creates a newMemoryNotificationInfoinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.Returns the name of the memory pool that the notification relates to.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.
-
Field Details
-
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:
-
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:
-
-
Constructor Details
-
MemoryNotificationInfo
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 Details
-
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
Returns the name of the memory pool that the notification relates to.- Returns:
- the name of the associated memory pool.
-
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
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.
-