src/share/classes/sun/tools/jconsole/MemoryPoolProxy.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net

@@ -54,11 +54,11 @@
         for (String name : mgrNames) {
             try {
                 ObjectName mbeanName = new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
                                                       ",name=" + name);
                 if (client.isRegistered(mbeanName)) {
-                    gcMBeans.put(mbeanName, new Long(0));
+                    gcMBeans.put(mbeanName, 0L);
                 }
             } catch (Exception e) {
                 assert false;
             }
 

@@ -95,11 +95,11 @@
                 client.getMXBean(e.getKey(),
                                  com.sun.management.GarbageCollectorMXBean.class);
             Long gcCount = e.getValue();
             Long newCount = gc.getCollectionCount();
             if (newCount > gcCount) {
-                gcMBeans.put(e.getKey(), new Long(newCount));
+                gcMBeans.put(e.getKey(), newCount);
                 lastGcInfo = gc.getLastGcInfo();
                 if (lastGcInfo.getEndTime() > lastGcEndTime) {
                     gcId = lastGcInfo.getId();
                     lastGcStartTime = lastGcInfo.getStartTime();
                     lastGcEndTime = lastGcInfo.getEndTime();