Search in sources :

Example 91 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project Payara by payara.

the class LocationsCommand method getUptime.

private long getUptime() {
    RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
    long totalTime_ms = -1;
    if (mxbean != null)
        totalTime_ms = mxbean.getUptime();
    if (totalTime_ms <= 0) {
        long start = env.getStartupContext().getCreationTime();
        totalTime_ms = System.currentTimeMillis() - start;
    }
    return totalTime_ms;
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 92 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project Payara by payara.

the class UptimeCommand method getUptime.

private long getUptime() {
    RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
    long totalTime_ms = -1;
    if (mxbean != null)
        totalTime_ms = mxbean.getUptime();
    if (totalTime_ms <= 0) {
        long start = env.getStartupContext().getCreationTime();
        totalTime_ms = System.currentTimeMillis() - start;
    }
    return totalTime_ms;
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Aggregations

RuntimeMXBean (java.lang.management.RuntimeMXBean)92 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)16 MemoryMXBean (java.lang.management.MemoryMXBean)11 IOException (java.io.IOException)9 GarbageCollectorMXBean (java.lang.management.GarbageCollectorMXBean)9 ThreadMXBean (java.lang.management.ThreadMXBean)8 MemoryUsage (java.lang.management.MemoryUsage)6 Method (java.lang.reflect.Method)6 ArrayList (java.util.ArrayList)6 ClassLoadingMXBean (java.lang.management.ClassLoadingMXBean)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5 Properties (java.util.Properties)5 InputStream (java.io.InputStream)4 MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)4 Field (java.lang.reflect.Field)4 Date (java.util.Date)4 BufferedReader (java.io.BufferedReader)3 File (java.io.File)3 InputStreamReader (java.io.InputStreamReader)3