Search in sources :

Example 31 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project incubator-gobblin by apache.

the class JvmUtils method getJvmInputArguments.

/**
 * Gets the input arguments passed to the JVM.
 * @return The input arguments.
 */
public static String getJvmInputArguments() {
    RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
    List<String> arguments = runtimeMxBean.getInputArguments();
    return String.format("JVM Input Arguments: %s", JOINER.join(arguments));
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 32 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project jvm-profiler by uber-common.

the class ProcessUtils method getJvmInputArguments.

public static List<String> getJvmInputArguments() {
    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    List<String> jvmArgs = runtimeMXBean.getInputArguments();
    return jvmArgs == null ? new ArrayList<>() : jvmArgs;
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 33 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project tesb-rt-se by Talend.

the class MetterCatcherUtils method getPid.

public static long getPid() {
    RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
    // $NON-NLS-1$
    String[] mxNameTable = mx.getName().split("@");
    if (mxNameTable.length == 2) {
        return Long.parseLong(mxNameTable[0]);
    } else {
        return Thread.currentThread().getId();
    }
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 34 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project tesb-rt-se by Talend.

the class StatCatcherUtils method getPid.

public static long getPid() {
    RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
    // $NON-NLS-1$
    String[] mxNameTable = mx.getName().split("@");
    if (mxNameTable.length == 2) {
        return Long.parseLong(mxNameTable[0]);
    } else {
        return Thread.currentThread().getId();
    }
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Example 35 with RuntimeMXBean

use of java.lang.management.RuntimeMXBean in project Mycat_plus by coderczp.

the class EnvironmentInformation method getJvmStartupOptionsArray.

/**
 * Gets the system parameters and environment parameters that were passed to the JVM on startup.
 *
 * @return The options passed to the JVM on startup.
 */
public static String[] getJvmStartupOptionsArray() {
    try {
        RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
        List<String> options = bean.getInputArguments();
        return options.toArray(new String[options.size()]);
    } catch (Throwable t) {
        return new String[0];
    }
}
Also used : RuntimeMXBean(java.lang.management.RuntimeMXBean)

Aggregations

RuntimeMXBean (java.lang.management.RuntimeMXBean)164 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)27 IOException (java.io.IOException)17 MemoryMXBean (java.lang.management.MemoryMXBean)16 ThreadMXBean (java.lang.management.ThreadMXBean)13 GarbageCollectorMXBean (java.lang.management.GarbageCollectorMXBean)11 Date (java.util.Date)10 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 MemoryUsage (java.lang.management.MemoryUsage)8 Method (java.lang.reflect.Method)8 Map (java.util.Map)8 Properties (java.util.Properties)6 InputStream (java.io.InputStream)5 ClassLoadingMXBean (java.lang.management.ClassLoadingMXBean)5 Iterator (java.util.Iterator)5 File (java.io.File)4 MemoryPoolMXBean (java.lang.management.MemoryPoolMXBean)4 Field (java.lang.reflect.Field)4 UnknownHostException (java.net.UnknownHostException)4