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 对象。