1 *java.lang.management.MemoryNotificationInfo* *MemoryNotificationInfo* The infor
3 public class MemoryNotificationInfo
4 extends |java.lang.Object|
6 |java.lang.management.MemoryNotificationInfo_Description|
7 |java.lang.management.MemoryNotificationInfo_Fields|
8 |java.lang.management.MemoryNotificationInfo_Constructors|
9 |java.lang.management.MemoryNotificationInfo_Methods|
11 ================================================================================
13 *java.lang.management.MemoryNotificationInfo_Fields*
14 |java.lang.String_java.lang.management.MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED|
15 |java.lang.String_java.lang.management.MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED|
17 *java.lang.management.MemoryNotificationInfo_Constructors*
18 |java.lang.management.MemoryNotificationInfo(String,MemoryUsage,long)|Construct
20 *java.lang.management.MemoryNotificationInfo_Methods*
21 |java.lang.management.MemoryNotificationInfo.from(CompositeData)|Returns a Memo
22 |java.lang.management.MemoryNotificationInfo.getCount()|Returns the number of t
23 |java.lang.management.MemoryNotificationInfo.getPoolName()|Returns the name of
24 |java.lang.management.MemoryNotificationInfo.getUsage()|Returns the memory usag
26 *java.lang.management.MemoryNotificationInfo_Description*
28 The information about a memory notification.
30 A memory notification is emitted by (|java.lang.management.MemoryMXBean|) when
31 the Java virtual machine detects that the memory usage of a memory pool is
32 exceeding a threshold value. The notification emitted will contain the memory
33 notification information about the detected condition:
35 The name of the memory pool. The memory usage of the memory pool when the
36 notification was constructed. The number of times that the memory usage has
37 crossed a threshold when the notification was constructed. For usage threshold
38 notifications, this count will be the usage threshold
39 count(|java.lang.management.MemoryPoolMXBean|) . For collection threshold
40 notifications, this count will be the collection usage threshold
41 count(|java.lang.management.MemoryPoolMXBean|) .
45 A CompositeData(|javax.management.openmbean.CompositeData|) representing the
46 MemoryNotificationInfo object is stored in the user
47 data(|javax.management.Notification|) of a
48 notification(|javax.management.Notification|) . The
49 from(|java.lang.management.MemoryNotificationInfo|) method is provided to
50 convert from a CompositeData to a MemoryNotificationInfo object. For example:
56 // receive the notification emitted by MemoryMXBean and set to notif ...
58 String notifType = notif.getType(); if
59 (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
60 notifType.equals(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED))
61 { // retrieve the memory notification information CompositeData cd =
62 (CompositeData) notif.getUserData(); MemoryNotificationInfo info =
63 MemoryNotificationInfo.from(cd); .... }
65 The types of notifications emitted by MemoryMXBean are:
67 A usage threshold exceeded
68 notification(|java.lang.management.MemoryNotificationInfo|) . This notification
69 will be emitted when the memory usage of a memory pool is increased and has
70 reached or exceeded its usage threshold value. Subsequent crossing of the usage
71 threshold value does not cause further notification until the memory usage has
72 returned to become less than the usage threshold value.
74 A collection usage threshold exceeded
75 notification(|java.lang.management.MemoryNotificationInfo|) . This notification
76 will be emitted when the memory usage of a memory pool is greater than or equal
79 collection usage threshold after the Java virtual machine has expended effort
80 in recycling unused objects in that memory pool.
84 *java.lang.String_java.lang.management.MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED*
86 Notification type denoting that the memory usage of a memory pool is greater
89 collection usage threshold after the Java virtual machine has expended effort
90 in recycling unused objects in that memory pool. This notification is emitted
91 by (|java.lang.management.MemoryMXBean|) . The value of this notification type
92 is java.management.memory.collection.threshold.exceeded.
95 *java.lang.String_java.lang.management.MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED*
97 Notification type denoting that the memory usage of a memory pool has reached
98 or exceeded its usage threshold value. This notification is emitted by
99 (|java.lang.management.MemoryMXBean|) . Subsequent crossing of the usage
100 threshold value does not cause further notification until the memory usage has
101 returned to become less than the usage threshold value. The value of this
102 notification type is java.management.memory.threshold.exceeded.
106 *java.lang.management.MemoryNotificationInfo(String,MemoryUsage,long)*
108 public MemoryNotificationInfo(
109 java.lang.String poolName,
110 java.lang.management.MemoryUsage usage,
113 Constructs a MemoryNotificationInfo object.
115 poolName - The name of the memory pool which triggers this notification.
116 usage - Memory usage of the memory pool.
117 count - The threshold crossing count.
119 *java.lang.management.MemoryNotificationInfo.from(CompositeData)*
121 public static |java.lang.management.MemoryNotificationInfo| from(javax.management.openmbean.CompositeData cd)
123 Returns a MemoryNotificationInfo object represented by the given CompositeData.
124 The given CompositeData must contain the following attributes:
130 poolName java.lang.String
132 usage javax.management.openmbean.CompositeData
139 cd - CompositeData representing a MemoryNotificationInfo
141 Returns: a MemoryNotificationInfo object represented by cd if cd is not null; null
144 *java.lang.management.MemoryNotificationInfo.getCount()*
146 public long getCount()
148 Returns the number of times that the memory usage has crossed a threshold when
149 the notification was constructed. For usage threshold notifications, this count
150 will be the threshold count(|java.lang.management.MemoryPoolMXBean|) . For
151 collection threshold notifications, this count will be the collection usage
152 threshold count(|java.lang.management.MemoryPoolMXBean|) .
156 Returns: the number of times that the memory usage has crossed a threshold when the
157 notification was constructed.
159 *java.lang.management.MemoryNotificationInfo.getPoolName()*
161 public |java.lang.String| getPoolName()
163 Returns the name of the memory pool that triggers this notification. The memory
164 pool usage has crossed a threshold.
168 Returns: the name of the memory pool that triggers this notification.
170 *java.lang.management.MemoryNotificationInfo.getUsage()*
172 public |java.lang.management.MemoryUsage| getUsage()
174 Returns the memory usage of the memory pool when this notification was
179 Returns: the memory usage of the memory pool when this notification was constructed.