Example usage for com.google.common.base StandardSystemProperty JAVA_VM_VENDOR

List of usage examples for com.google.common.base StandardSystemProperty JAVA_VM_VENDOR

Introduction

In this page you can find the example usage for com.google.common.base StandardSystemProperty JAVA_VM_VENDOR.

Prototype

StandardSystemProperty JAVA_VM_VENDOR

To view the source code for com.google.common.base StandardSystemProperty JAVA_VM_VENDOR.

Click Source Link

Document

Java Virtual Machine implementation vendor.

Usage

From source file:org.glowroot.agent.init.ProcessInfoCreator.java

public static ProcessInfo create(String glowrootVersion) {
    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    Long processId = parseProcessId(ManagementFactory.getRuntimeMXBean().getName());
    String jvm = "";
    String javaVmName = StandardSystemProperty.JAVA_VM_NAME.value();
    if (javaVmName != null) {
        jvm = javaVmName + " (" + StandardSystemProperty.JAVA_VM_VERSION.value() + ", "
                + System.getProperty("java.vm.info") + ")";
    }/* w  ww.j  a  va2  s.  co  m*/
    String java = "";
    String javaVersion = StandardSystemProperty.JAVA_VERSION.value();
    if (javaVersion != null) {
        java = "version " + javaVersion + ", vendor " + StandardSystemProperty.JAVA_VM_VENDOR.value();
    }
    String heapDumpPath = getHeapDumpPathFromCommandLine();
    if (heapDumpPath == null) {
        String javaTempDir = MoreObjects.firstNonNull(StandardSystemProperty.JAVA_IO_TMPDIR.value(), ".");
        heapDumpPath = new File(javaTempDir).getAbsolutePath();
    }
    ProcessInfo.Builder builder = ProcessInfo.newBuilder();
    try {
        builder.setHostName(InetAddress.getLocalHost().getHostName());
    } catch (UnknownHostException e) {
        logger.warn(e.getMessage(), e);
    }
    if (processId != null) {
        builder.setProcessId(OptionalInt64.newBuilder().setValue(processId).build());
    }
    return builder.setStartTime(runtimeMXBean.getStartTime()).setJvm(jvm).setJava(java)
            .addAllJvmArg(runtimeMXBean.getInputArguments()).setHeapDumpDefaultDir(heapDumpPath)
            .setGlowrootAgentVersion(glowrootVersion).build();
}

From source file:org.killbill.billing.server.updatechecker.ClientInfo.java

public String getJavaVMVendor() {
    return getProperty(StandardSystemProperty.JAVA_VM_VENDOR);
}

From source file:org.glowroot.local.ui.JvmJsonService.java

@GET("/backend/jvm/process-info")
String getProcess() throws Exception {
    String command = System.getProperty("sun.java.command");
    String mainClass = null;//from   www . j  ava 2s  .c o  m
    List<String> arguments = ImmutableList.of();
    if (command != null) {
        int index = command.indexOf(' ');
        if (index > 0) {
            mainClass = command.substring(0, index);
            arguments = Lists.newArrayList(Splitter.on(' ').split(command.substring(index + 1)));
        }
    }
    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    String jvm = StandardSystemProperty.JAVA_VM_NAME.value() + " ("
            + StandardSystemProperty.JAVA_VM_VERSION.value() + ", " + System.getProperty("java.vm.info") + ")";
    String java = "version " + StandardSystemProperty.JAVA_VERSION.value() + ", vendor "
            + StandardSystemProperty.JAVA_VM_VENDOR.value();
    String javaHome = StandardSystemProperty.JAVA_HOME.value();

    StringBuilder sb = new StringBuilder();
    JsonGenerator jg = mapper.getFactory().createGenerator(CharStreams.asWriter(sb));
    jg.writeStartObject();
    jg.writeNumberField("startTime", runtimeMXBean.getStartTime());
    jg.writeNumberField("uptime", runtimeMXBean.getUptime());
    jg.writeStringField("pid", MoreObjects.firstNonNull(processId, "<unknown>"));
    jg.writeStringField("mainClass", mainClass);
    jg.writeFieldName("mainClassArguments");
    mapper.writeValue(jg, arguments);
    jg.writeStringField("jvm", jvm);
    jg.writeStringField("java", java);
    jg.writeStringField("javaHome", javaHome);
    jg.writeFieldName("jvmArguments");
    mapper.writeValue(jg, runtimeMXBean.getInputArguments());
    jg.writeEndObject();
    jg.close();
    return sb.toString();
}