1 7 8 package java.lang.management; 9 import javax.management.openmbean.CompositeData ; 10 import sun.management.MemoryNotifInfoCompositeData; 11 12 90 public class MemoryNotificationInfo { 91 private final String poolName; 92 private final MemoryUsage usage; 93 private final long count; 94 95 107 public static final String MEMORY_THRESHOLD_EXCEEDED = 108 "java.management.memory.threshold.exceeded"; 109 110 121 public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED = 122 "java.management.memory.collection.threshold.exceeded"; 123 124 131 public MemoryNotificationInfo(String poolName, 132 MemoryUsage usage, 133 long count) { 134 if (poolName == null) { 135 throw new NullPointerException ("Null poolName"); 136 } 137 if (usage == null) { 138 throw new NullPointerException ("Null usage"); 139 } 140 141 this.poolName = poolName; 142 this.usage = usage; 143 this.count = count; 144 } 145 146 MemoryNotificationInfo(CompositeData cd) { 147 MemoryNotifInfoCompositeData.validateCompositeData(cd); 148 149 this.poolName = MemoryNotifInfoCompositeData.getPoolName(cd); 150 this.usage = MemoryNotifInfoCompositeData.getUsage(cd); 151 this.count = MemoryNotifInfoCompositeData.getCount(cd); 152 } 153 154 160 public String getPoolName() { 161 return poolName; 162 } 163 164 171 public MemoryUsage getUsage() { 172 return usage; 173 } 174 175 188 public long getCount() { 189 return count; 190 } 191 192 228 public static MemoryNotificationInfo from(CompositeData cd) { 229 if (cd == null) { 230 return null; 231 } 232 233 if (cd instanceof MemoryNotifInfoCompositeData) { 234 return ((MemoryNotifInfoCompositeData) cd).getMemoryNotifInfo(); 235 } else { 236 return new MemoryNotificationInfo (cd); 237 } 238 } 239 } 240 | Popular Tags |