java.lang.management
public class MemoryNotificationInfo extends Object
Represents the content of a notification emitted by the
MemoryMXBean
. Such notifications are emitted when
one of the memory pools exceeds its usage or collection
usage threshold. This object contains the following information,
representing the state of the pool at the time of the
notification:
Two types of notification are emitted by the MemoryMXBean
:
one for exceeding the usage threshold and one for exceeding the
collection usage threshold. The value returned by getCount()
is dependent on this type; if the threshold exceeded is the usage
threshold, then the usage threshold count is returned. If, instead,
the collection usage threshold is exceeded, then the collection usage
threshold count is returned.
This data is held in the user data part of the notification (returned
by Notification.getUserData()
) encapsulated in
a CompositeData
object. The
from(javax.management.openmbean.CompositeData)
method may be
used to unwrap the value and obtain an instance of this class.
Modifier and Type | Field and Description |
---|---|
static String |
MEMORY_COLLECTION_THRESHOLD_EXCEEDED
The type of notification emitted when the collection usage threshold
is exceeded, following a garbage collection cycle.
|
static String |
MEMORY_THRESHOLD_EXCEEDED
The type of notification emitted when the usage threshold is exceeded.
|
Constructor and Description |
---|
MemoryNotificationInfo(String poolName,
MemoryUsage usage,
long count)
Constructs a new
MemoryNotificationInfo object using the
specified pool name, usage level and threshold crossing count. |
Modifier and Type | Method and Description |
---|---|
static MemoryNotificationInfo |
from(CompositeData data)
Returns a
MemoryNotificationInfo instance using the values
given in the supplied
CompositeData object. |
long |
getCount()
Returns the number of times the memory pool has crossed the usage
threshold, as of the time of notification.
|
String |
getPoolName()
Returns the name of the pool which has crossed a threshold.
|
MemoryUsage |
getUsage()
Returns the usage levels at the time of notification.
|
public static final String MEMORY_THRESHOLD_EXCEEDED
java.management.memory.threshold.exceeded
.public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED
java.management.memory.collection.threshold.exceeded
.public MemoryNotificationInfo(String poolName, MemoryUsage usage, long count)
MemoryNotificationInfo
object using the
specified pool name, usage level and threshold crossing count.poolName
- the name of the pool which has exceeded a threshold.usage
- the usage level of the pool at the time of notification.count
- the number of times the threshold has been crossed.public static MemoryNotificationInfo from(CompositeData data)
Returns a MemoryNotificationInfo
instance using the values
given in the supplied
CompositeData
object.
The composite data instance should contain the following
attributes with the specified types:
Name | Type |
poolName | java.lang.String |
usage | javax.management.openmbean.CompositeData |
count | java.lang.Long |
The usage level is further described as:
Name | Type |
init | java.lang.Long |
used | java.lang.Long |
committed | java.lang.Long |
max | java.lang.Long |
data
- the composite data structure to take values from.null
if the data structure was also null
.IllegalArgumentException
- if the composite data structure
does not match the structure
outlined above.public long getCount()
MEMORY_THRESHOLD_EXCEEDED
, then the
count is the usage threshold count. If this is the notification
represented by the type MEMORY_COLLECTION_THRESHOLD_EXCEEDED
,
then the count is the collection usage threshold count.public String getPoolName()
public MemoryUsage getUsage()