Example usage for java.lang.management CompilationMXBean getName

List of usage examples for java.lang.management CompilationMXBean getName

Introduction

In this page you can find the example usage for java.lang.management CompilationMXBean getName.

Prototype

public java.lang.String getName();

Source Link

Document

Returns the name of the Just-in-time (JIT) compiler.

Usage

From source file:org.fluentd.jvmwatcher.data.JvmWatchState.java

/**
 * @param clientPrixy//from   w  w  w .j a  va  2  s.c om
 * @return
 */
public static JvmWatchState makeJvmWatchState(JvmClientProxy clientProxy) {
    // null check
    if (null == clientProxy) {
        return null;
    }
    if (null == clientProxy.getLocalJvmInfo()) {
        return null;
    }

    // create data object
    JvmWatchState ret = new JvmWatchState();

    // set Local JVM Information
    ret.commandLine_ = clientProxy.getLocalJvmInfo().getCommandLine_();
    ret.displayName_ = clientProxy.getLocalJvmInfo().getDisplayName();
    ret.jvmId_ = clientProxy.getLocalJvmInfo().getJvmid();
    ret.shortName_ = clientProxy.getLocalJvmInfo().getShortName();

    // create log line array
    ret.stateLog_ = new ArrayList<JvmStateLog>();

    // set JVM information
    try {
        // CompilationMXBean
        CompilationMXBean compilationBean = clientProxy.getCompilationMXBean();
        if (null != compilationBean) {
            ret.jitName_ = compilationBean.getName();
        }

        // OperatingSystemMXBean
        OperatingSystemMXBean OpeSysBean = clientProxy.getOperatingSystemMXBean();
        if (null != OpeSysBean) {
            ret.osArch_ = OpeSysBean.getArch();
            ret.osName_ = OpeSysBean.getName();
            ret.osVersion_ = OpeSysBean.getVersion();
        }

        // RuntimeMXBean
        RuntimeMXBean runtimeBean = clientProxy.getRuntimeMXBean();
        if (null != runtimeBean) {
            ret.jvmStartTime_ = runtimeBean.getStartTime();
            ret.jvmRuntimeName_ = runtimeBean.getName();
            ret.vmName_ = runtimeBean.getVmName();
            ret.vmVender_ = runtimeBean.getVmVendor();
            ret.vmVersion_ = runtimeBean.getVmVersion();
            ret.specName_ = runtimeBean.getSpecName();
            ret.specVender_ = runtimeBean.getSpecVendor();
            ret.specVersion_ = runtimeBean.getSpecVersion();
        }
    } catch (IOException ex) {
        log.error("get MXBean error.", ex);
        // close JvmClientProxy
        clientProxy.disconnect();
    } catch (Exception ex) {
        log.error("get MXBean error.", ex);
        // close JvmClientProxy
        clientProxy.disconnect();
    }

    return ret;
}