public class GetMem extends java.lang.Object
Note: this class is likely to be used in contexts where we don't
have logging set up, so System.err
and System.out
are used.
Constructor and Description |
---|
GetMem() |
Modifier and Type | Method and Description |
---|---|
private <T> T |
callMXBeanMethod(java.lang.String methodName,
T defaultValue)
Call a method belonging to
OperatingSystemMXBean and return
the result. |
static java.lang.String |
getMemory()
Get total system memory and print it out--accounts for 32bit JRE
limitation of 1.5GB.
|
static void |
main(java.lang.String[] args)
The main.
|
public GetMem()
private <T> T callMXBeanMethod(java.lang.String methodName, T defaultValue)
OperatingSystemMXBean
and return
the result.T
- Type of the expected return and defaultValue
.methodName
- Name of OperatingSystemMXBean
method to call.
Cannot be null
or empty.defaultValue
- Value returned if methodName
call fails.methodName
call, or
defaultValue
.public static java.lang.String getMemory()
String
representation of the total amount of system
memory.public static void main(java.lang.String[] args)
args
- Ignored.