java.lang.management
Class MemoryNotification

java.lang.Object
  extended by java.util.EventObject
      extended by javax.management.Notification
          extended by java.lang.management.MemoryNotification
All Implemented Interfaces:
Serializable

public class MemoryNotification
extends Notification

A memory notification emitted by MemoryMBean indicating that the Java virtual machine detects that the memory usage of a memory pool is crossing a threshold value.

The types of notifications emitted by MemoryMBean are:

A memory notification contains the following information of a memory pool about the detected condition:

Since:
1.5
See Also:
Serialized Form

Field Summary
static String MEMORY_COLLECTION_THRESHOLD_EXCEEDED
          Notification type denoting that the memory usage of a memory pool is greater than or equal to its collection usage threshold after the Java virtual machine has expended effort in recycling unused objects in that memory pool.
static String MEMORY_THRESHOLD_EXCEEDED
          Notification type denoting that the memory usage of a memory pool has reached or exceeded its usage threshold value.
 
Constructor Summary
MemoryNotification(String type, String poolName, MemoryUsage usage, long count, long sequenceNumber, long timeStamp, String msg)
          Constructs a MemoryNotification object with the ObjectName of MemoryMBean as the source.
 
Method Summary
 long getCount()
          Returns the number of times that the memory usage has crossed a threshold when the notification was constructed.
 String getPoolName()
          Returns the name of the memory pool that triggers this notification.
 MemoryUsage getUsage()
          Returns the memory usage of the memory pool when this notification was constructed.
 
Methods inherited from class javax.management.Notification
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MEMORY_THRESHOLD_EXCEEDED

public static final String MEMORY_THRESHOLD_EXCEEDED
Notification type denoting that the memory usage of a memory pool has reached or exceeded its usage threshold value. This notification is emitted by MemoryMBean. Subsequent crossing of the usage threshold value does not cause further notification until the memory usage has returned to become less than the usage threshold value. The value of this notification type is java.management.memory.threshold.exceeded.

See Also:
Constant Field Values

MEMORY_COLLECTION_THRESHOLD_EXCEEDED

public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED
Notification type denoting that the memory usage of a memory pool is greater than or equal to its collection usage threshold after the Java virtual machine has expended effort in recycling unused objects in that memory pool. This notification is emitted by MemoryMBean. The value of this notification type is java.management.memory.collection.threshold.exceeded.

See Also:
Constant Field Values
Constructor Detail

MemoryNotification

public MemoryNotification(String type,
                          String poolName,
                          MemoryUsage usage,
                          long count,
                          long sequenceNumber,
                          long timeStamp,
                          String msg)
Constructs a MemoryNotification object with the ObjectName of MemoryMBean as the source.

Parameters:
type - The notification type.
poolName - The name of the memory pool which triggers this notification.
usage - Memory usage of the memory pool.
count - The threshold crossing count.
sequenceNumber - The notification sequence number within the source object.
timeStamp - The date at which the notification is being sent.
msg - A String containing the message of the notification.
Throws:
IllegalArgumentException - if sequenceNumber or timeStamp is negative.
Method Detail

getPoolName

public String getPoolName()
Returns the name of the memory pool that triggers this notification. The memory pool usage has crossed a threshold.

Returns:
the name of the memory pool that triggers this notification.

getUsage

public MemoryUsage getUsage()
Returns the memory usage of the memory pool when this notification was constructed.

Returns:
the memory usage of the memory pool when this notification was constructed.

getCount

public long getCount()
Returns the number of times that the memory usage has crossed a threshold when the notification was constructed. For usage threshold notifications, this count will be the threshold count. For collection threshold notifications, this count will be the collection usage threshold count.

Returns:
the number of times that the memory usage has crossed a threshold when the notification was constructed.