提交 0a6de9ec 编写于 作者: E emcmanus

Merge

...@@ -26,7 +26,6 @@ package sun.management.snmp.jvminstr; ...@@ -26,7 +26,6 @@ package sun.management.snmp.jvminstr;
// java imports // java imports
// //
import java.io.Serializable;
import java.util.Map; import java.util.Map;
// jmx imports // jmx imports
...@@ -36,9 +35,7 @@ import com.sun.jmx.snmp.SnmpDefinitions; ...@@ -36,9 +35,7 @@ import com.sun.jmx.snmp.SnmpDefinitions;
// jdmk imports // jdmk imports
// //
import com.sun.jmx.snmp.agent.SnmpMib;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage; import java.lang.management.MemoryUsage;
import java.lang.management.MemoryType; import java.lang.management.MemoryType;
import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryPoolMXBean;
...@@ -73,7 +70,9 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean { ...@@ -73,7 +70,9 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
"jvmMemPoolEntry.getCollectionUsage"; "jvmMemPoolEntry.getCollectionUsage";
final static MemoryUsage ZEROS = new MemoryUsage(0,0,0,0); final static MemoryUsage ZEROS = new MemoryUsage(0,0,0,0);
final String entryMemoryTag;
final String entryPeakMemoryTag;
final String entryCollectMemoryTag;
MemoryUsage getMemoryUsage() { MemoryUsage getMemoryUsage() {
try { try {
...@@ -81,17 +80,17 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean { ...@@ -81,17 +80,17 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (m != null) { if (m != null) {
final MemoryUsage cached = (MemoryUsage) final MemoryUsage cached = (MemoryUsage)
m.get(memoryTag); m.get(entryMemoryTag);
if (cached != null) { if (cached != null) {
log.debug("getMemoryUsage", log.debug("getMemoryUsage",entryMemoryTag+
"jvmMemPoolEntry.getUsage found in cache."); " found in cache.");
return cached; return cached;
} }
MemoryUsage u = pool.getUsage(); MemoryUsage u = pool.getUsage();
if (u == null) u = ZEROS; if (u == null) u = ZEROS;
m.put(memoryTag,u); m.put(entryMemoryTag,u);
return u; return u;
} }
// Should never come here. // Should never come here.
...@@ -113,18 +112,18 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean { ...@@ -113,18 +112,18 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (m != null) { if (m != null) {
final MemoryUsage cached = (MemoryUsage) final MemoryUsage cached = (MemoryUsage)
m.get(peakMemoryTag); m.get(entryPeakMemoryTag);
if (cached != null) { if (cached != null) {
if (log.isDebugOn()) if (log.isDebugOn())
log.debug("getPeakMemoryUsage", log.debug("getPeakMemoryUsage",
peakMemoryTag + " found in cache."); entryPeakMemoryTag + " found in cache.");
return cached; return cached;
} }
MemoryUsage u = pool.getPeakUsage(); MemoryUsage u = pool.getPeakUsage();
if (u == null) u = ZEROS; if (u == null) u = ZEROS;
m.put(peakMemoryTag,u); m.put(entryPeakMemoryTag,u);
return u; return u;
} }
// Should never come here. // Should never come here.
...@@ -146,18 +145,18 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean { ...@@ -146,18 +145,18 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (m != null) { if (m != null) {
final MemoryUsage cached = (MemoryUsage) final MemoryUsage cached = (MemoryUsage)
m.get(collectMemoryTag); m.get(entryCollectMemoryTag);
if (cached != null) { if (cached != null) {
if (log.isDebugOn()) if (log.isDebugOn())
log.debug("getCollectMemoryUsage", log.debug("getCollectMemoryUsage",
collectMemoryTag + " found in cache."); entryCollectMemoryTag + " found in cache.");
return cached; return cached;
} }
MemoryUsage u = pool.getCollectionUsage(); MemoryUsage u = pool.getCollectionUsage();
if (u == null) u = ZEROS; if (u == null) u = ZEROS;
m.put(collectMemoryTag,u); m.put(entryCollectMemoryTag,u);
return u; return u;
} }
// Should never come here. // Should never come here.
...@@ -179,9 +178,12 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean { ...@@ -179,9 +178,12 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
/** /**
* Constructor for the "JvmMemPoolEntry" group. * Constructor for the "JvmMemPoolEntry" group.
*/ */
public JvmMemPoolEntryImpl(MemoryPoolMXBean mp, int index) { public JvmMemPoolEntryImpl(MemoryPoolMXBean mp, final int index) {
this.pool=mp; this.pool=mp;
this.jvmMemPoolIndex = index; this.jvmMemPoolIndex = index;
this.entryMemoryTag = memoryTag + "." + index;
this.entryPeakMemoryTag = peakMemoryTag + "." + index;
this.entryCollectMemoryTag = collectMemoryTag + "." + index;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册