src/share/classes/sun/management/snmp/jvminstr/JvmMemoryImpl.java

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

*** 220,274 **** log.debug("getHeapMemoryUsage",x); throw x; } } ! static final Long Long0 = new Long(0); /** * Getter for the "JvmMemoryNonHeapMaxSize" variable. */ public Long getJvmMemoryNonHeapMaxSize() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getMax(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryNonHeapCommitted" variable. */ public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getCommitted(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryNonHeapUsed" variable. */ public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getUsed(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryNonHeapInitSize" variable. */ public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getInit(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryHeapMaxSize" variable. */ public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException { final long val = getHeapMemoryUsage().getMax(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryGCCall" variable. --- 220,274 ---- log.debug("getHeapMemoryUsage",x); throw x; } } ! static final Long Long0 = 0L; /** * Getter for the "JvmMemoryNonHeapMaxSize" variable. */ public Long getJvmMemoryNonHeapMaxSize() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getMax(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryNonHeapCommitted" variable. */ public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getCommitted(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryNonHeapUsed" variable. */ public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getUsed(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryNonHeapInitSize" variable. */ public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException { final long val = getNonHeapMemoryUsage().getInit(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryHeapMaxSize" variable. */ public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException { final long val = getHeapMemoryUsage().getMax(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryGCCall" variable.
*** 318,328 **** /** * Getter for the "JvmMemoryHeapCommitted" variable. */ public Long getJvmMemoryHeapCommitted() throws SnmpStatusException { final long val = getHeapMemoryUsage().getCommitted(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryGCVerboseLevel" variable. --- 318,328 ---- /** * Getter for the "JvmMemoryHeapCommitted" variable. */ public Long getJvmMemoryHeapCommitted() throws SnmpStatusException { final long val = getHeapMemoryUsage().getCommitted(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryGCVerboseLevel" variable.
*** 357,376 **** /** * Getter for the "JvmMemoryHeapUsed" variable. */ public Long getJvmMemoryHeapUsed() throws SnmpStatusException { final long val = getHeapMemoryUsage().getUsed(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryHeapInitSize" variable. */ public Long getJvmMemoryHeapInitSize() throws SnmpStatusException { final long val = getHeapMemoryUsage().getInit(); ! if (val > -1) return new Long(val); else return Long0; } /** * Getter for the "JvmMemoryPendingFinalCount" variable. --- 357,376 ---- /** * Getter for the "JvmMemoryHeapUsed" variable. */ public Long getJvmMemoryHeapUsed() throws SnmpStatusException { final long val = getHeapMemoryUsage().getUsed(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryHeapInitSize" variable. */ public Long getJvmMemoryHeapInitSize() throws SnmpStatusException { final long val = getHeapMemoryUsage().getInit(); ! if (val > -1) return val; else return Long0; } /** * Getter for the "JvmMemoryPendingFinalCount" variable.
*** 378,391 **** public Long getJvmMemoryPendingFinalCount() throws SnmpStatusException { final long val = ManagementFactory.getMemoryMXBean(). getObjectPendingFinalizationCount(); ! if (val > -1) return new Long((int)val); // Should never happen... but stay safe all the same. // ! else return new Long(0); } static final MibLogger log = new MibLogger(JvmMemoryImpl.class); } --- 378,391 ---- public Long getJvmMemoryPendingFinalCount() throws SnmpStatusException { final long val = ManagementFactory.getMemoryMXBean(). getObjectPendingFinalizationCount(); ! if (val > -1) return val; // Should never happen... but stay safe all the same. // ! else return 0L; } static final MibLogger log = new MibLogger(JvmMemoryImpl.class); }