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,55 +220,55 @@
log.debug("getHeapMemoryUsage",x);
throw x;
}
}
- static final Long Long0 = new Long(0);
+ static final Long Long0 = 0L;
/**
* Getter for the "JvmMemoryNonHeapMaxSize" variable.
*/
public Long getJvmMemoryNonHeapMaxSize()
throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getMax();
- if (val > -1) return new Long(val);
+ 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 new Long(val);
+ 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 new Long(val);
+ 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 new Long(val);
+ 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 new Long(val);
+ if (val > -1) return val;
else return Long0;
}
/**
* Getter for the "JvmMemoryGCCall" variable.
@@ -318,11 +318,11 @@
/**
* Getter for the "JvmMemoryHeapCommitted" variable.
*/
public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getCommitted();
- if (val > -1) return new Long(val);
+ if (val > -1) return val;
else return Long0;
}
/**
* Getter for the "JvmMemoryGCVerboseLevel" variable.
@@ -357,20 +357,20 @@
/**
* Getter for the "JvmMemoryHeapUsed" variable.
*/
public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getUsed();
- if (val > -1) return new Long(val);
+ 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 new Long(val);
+ if (val > -1) return val;
else return Long0;
}
/**
* Getter for the "JvmMemoryPendingFinalCount" variable.
@@ -378,14 +378,14 @@
public Long getJvmMemoryPendingFinalCount()
throws SnmpStatusException {
final long val = ManagementFactory.getMemoryMXBean().
getObjectPendingFinalizationCount();
- if (val > -1) return new Long((int)val);
+ if (val > -1) return val;
// Should never happen... but stay safe all the same.
//
- else return new Long(0);
+ else return 0L;
}
static final MibLogger log = new MibLogger(JvmMemoryImpl.class);
}