|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.lang.management.MemoryNotificationInfo
public class MemoryNotificationInfo
關於記憶體通知的資訊。
當 Java 虛擬機器檢測到記憶體池的記憶體使用量超過了閾值時,MemoryMXBean 將發出記憶體通知。發出的通知將包含關於檢測到的情況的記憶體通知資訊:
表示 MemoryNotificationInfo 物件的 CompositeData 存儲在通知的使用者資料中。提供了表單方法將 CompositeData 轉換為 MemoryNotificationInfo 物件。例如:
Notification notif;
// receive the notification emitted by MemoryMXBean and set to notif
...
String notifType = notif.getType();
if (notifType.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
notifType.equals(MemoryNotificationInfo.MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
// retrieve the memory notification information
CompositeData cd = (CompositeData) notif.getUserData();
MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
....
}
MemoryMXBean 發出的通知型別為:
使用量閾值超過通知。集合使用量閾值超過通知。
| 欄位摘要 | |
|---|---|
static String |
MEMORY_COLLECTION_THRESHOLD_EXCEEDED
表示當 Java 虛擬機器對記憶體池中的不使用的物件進行了回收工作之後,記憶體池的記憶體使用量大於或等於其集合使用量閾值的通知型別。 |
static String |
MEMORY_THRESHOLD_EXCEEDED
表示記憶體池的記憶體使用量已達到或超過其使用量閾值的通知型別。 |
| 建構子摘要 | |
|---|---|
MemoryNotificationInfo(String poolName,
MemoryUsage usage,
long count)
建構一個 MemoryNotificationInfo 物件。 |
|
| 方法摘要 | |
|---|---|
static MemoryNotificationInfo |
from(CompositeData cd)
返回由給定 CompositeData 表示的 MemoryNotificationInfo 物件。 |
long |
getCount()
返回建構通知時記憶體使用量超過閾值的次數。 |
String |
getPoolName()
返回觸發此通知的記憶體池的名稱。 |
MemoryUsage |
getUsage()
返回建構此通知時記憶體池的記憶體使用量。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 欄位詳細資訊 |
|---|
public static final String MEMORY_THRESHOLD_EXCEEDED
MemoryMXBean 發出。後續的使用量閾值超過情況不會導致更多的通知,一直到記憶體使用量返回到小於使用量閾值的狀態為止。此通知型別的值為 java.management.memory.threshold.exceeded。
public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED
MemoryMXBean 發出。此通知型別的值為 java.management.memory.collection.threshold.exceeded。
| 建構子詳細資訊 |
|---|
public MemoryNotificationInfo(String poolName,
MemoryUsage usage,
long count)
poolName - 觸發此通知的記憶體池的名稱。usage - 記憶體池的記憶體使用量。count - 超過閾值的次數計數。| 方法詳細資訊 |
|---|
public String getPoolName()
public MemoryUsage getUsage()
public long getCount()
閾值計數。對於集合使用量閾值通知,此計數將為集合使用量閾值計數。
public static MemoryNotificationInfo from(CompositeData cd)
屬性名稱 型別 poolName java.lang.String usage javax.management.openmbean.CompositeData count java.lang.Long
cd - 表示 MemoryNotificationInfo 的 CompositeData
IllegalArgumentException - 如果 cd 不表示 MemoryNotificationInfo 物件。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。