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 String
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.static final String
Notification 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 newMemoryNotificationInfo
instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryNotificationInfo
from
(CompositeData cd) Receives aCompositeData
representing aMemoryNotificationInfo
object and attempts to return the rootMemoryNotificationInfo
instance.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.Returns the name of the memory pool that the notification relates to.getUsage()
Returns an instance ofMemoryUsage
that 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 newMemoryNotificationInfo
instance.- 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_EXCEEDED
type, this will a count of the number of times the memory usage threshold has been met or exceeded. ForMEMORY_COLLECTION_THRESHOLD_EXCEEDED
notifications, 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_EXCEEDED
type, this will a count of the number of times the memory usage threshold has been met or exceeded. ForMEMORY_COLLECTION_THRESHOLD_EXCEEDED
notifications, 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 ofMemoryUsage
that encapsulates the memory usage of the memory pool that gave rise to this notification at the time the notification was created. TheMemoryUsage
may 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 aCompositeData
representing aMemoryNotificationInfo
object and attempts to return the rootMemoryNotificationInfo
instance.- Parameters:
cd
- aCompositeDate
that represents aMemoryNotificationInfo
.- Returns:
- if
cd
is non-null
, returns a new instance ofMemoryNotificationInfo
. Ifcd
isnull
, returnsnull
. - Throws:
IllegalArgumentException
- if argumentcd
does not correspond to aMemoryNotificationInfo
with the following attributes:poolName
(java.lang.String
)usage
(javax.management.openmbean.CompositeData
)count
(java.lang.Long
)
The
usage
attribute must represent aMemoryUsage
instance which encapsulates the memory usage of a memory pool.
-