List of usage examples for com.google.common.base StandardSystemProperty JAVA_VM_VERSION
StandardSystemProperty JAVA_VM_VERSION
To view the source code for com.google.common.base StandardSystemProperty JAVA_VM_VERSION.
Click Source Link
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 w w. j a v a 2s.c o 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:com.facebook.buck.util.environment.AbstractBuildEnvironmentDescription.java
public static BuildEnvironmentDescription of(ExecutionEnvironment executionEnvironment, ImmutableList<String> cacheModes, ImmutableMap<String, String> extraData) { Optional<Boolean> buckDirty; String dirty = System.getProperty("buck.git_dirty", "unknown"); if (dirty.equals("1")) { buckDirty = Optional.of(true); } else if (dirty.equals("0")) { buckDirty = Optional.of(false); } else {/*ww w. j a v a2s . co m*/ buckDirty = Optional.empty(); } return BuildEnvironmentDescription.builder().setUser(executionEnvironment.getUsername()) .setHostname(executionEnvironment.getHostname()) .setOs(executionEnvironment.getPlatform().getPrintableName().toLowerCase().replace(' ', '_')) .setAvailableCores(executionEnvironment.getAvailableCores()) .setSystemMemory(executionEnvironment.getTotalMemory()).setBuckDirty(buckDirty) .setBuckCommit(System.getProperty("buck.git_commit", "unknown")) .setJavaVersion(StandardSystemProperty.JAVA_VM_VERSION.value()).setCacheModes(cacheModes) .setExtraData(extraData).build(); }
From source file:org.glowroot.agent.init.EnvironmentCreator.java
private static JavaInfo createJavaInfo(String glowrootVersion, JvmConfig jvmConfig, RuntimeMXBean runtimeMXBean) { 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 w w. j a va 2 s .co m*/ String javaVersion = StandardSystemProperty.JAVA_VERSION.value(); String heapDumpPath = getHeapDumpPathFromCommandLine(); if (heapDumpPath == null) { String javaTempDir = MoreObjects.firstNonNull(StandardSystemProperty.JAVA_IO_TMPDIR.value(), "."); heapDumpPath = new File(javaTempDir).getAbsolutePath(); } return JavaInfo.newBuilder().setVersion(Strings.nullToEmpty(javaVersion)).setVm(jvm) .addAllArg(Masking.maskJvmArgs(runtimeMXBean.getInputArguments(), jvmConfig.maskSystemProperties())) .setHeapDumpDefaultDir(heapDumpPath).setGlowrootAgentVersion(glowrootVersion).build(); }
From source file:org.killbill.billing.server.updatechecker.ClientInfo.java
public String getJavaVMVersion() { return getProperty(StandardSystemProperty.JAVA_VM_VERSION); }
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 w w w . ja v a2 s . 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(); }