List of usage examples for com.google.common.base StandardSystemProperty JAVA_VERSION
StandardSystemProperty JAVA_VERSION
To view the source code for com.google.common.base StandardSystemProperty JAVA_VERSION.
Click Source Link
From source file:com.facebook.presto.server.JavaVersion.java
public static JavaVersion current() { return parse(StandardSystemProperty.JAVA_VERSION.value()); }
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 2 s . com 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:io.prestosql.server.PrestoSystemRequirements.java
private static void verifyJavaVersion() { String javaVersion = StandardSystemProperty.JAVA_VERSION.value(); if (javaVersion == null) { failRequirement("Java version not defined"); }//from w w w .j a va2 s .com JavaVersion version = JavaVersion.parse(javaVersion); if (version.getMajor() == 8 && version.getUpdate().isPresent() && version.getUpdate().getAsInt() >= 151) { return; } if (version.getMajor() >= 9) { return; } failRequirement("Presto requires Java 8u151+ (found %s)", javaVersion); }
From source file:org.killbill.billing.server.updatechecker.ClientInfo.java
public String getJavaVersion() { return getProperty(StandardSystemProperty.JAVA_VERSION); }
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") + ")"; }// www. j a va 2 s . c om 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:edu.buaa.satla.analysis.core.CPAchecker.java
public static String getVersion() { return getCPAcheckerVersion() + " (" + StandardSystemProperty.JAVA_VM_NAME.value() + " " + StandardSystemProperty.JAVA_VERSION.value() + ")"; }
From source file:org.glowroot.central.CentralModule.java
private CentralModule(File centralDir, @Nullable ServletContext servletContext) throws Exception { servlet = servletContext != null;/* w w w . ja v a 2 s. c o m*/ ClusterManager clusterManager = null; Cluster cluster = null; Session session = null; ExecutorService repoAsyncExecutor = null; CentralRepoModule repos = null; AlertingService alertingService = null; CentralAlertingService centralAlertingService = null; GrpcServer grpcServer = null; UpdateAgentConfigIfNeededService updateAgentConfigIfNeededService = null; RollupService rollupService = null; SyntheticMonitorService syntheticMonitorService = null; UiModule uiModule = null; try { Directories directories = new Directories(centralDir); // init logger as early as possible initLogging(directories.getConfDir(), directories.getLogDir()); Clock clock = Clock.systemClock(); Ticker ticker = Ticker.systemTicker(); String version; if (servletContext == null) { version = Version.getVersion(CentralModule.class); } else { version = Version.getVersion(servletContext.getResource("/META-INF/MANIFEST.MF")); } startupLogger.info("Glowroot version: {}", version); startupLogger.info("Java version: {}", StandardSystemProperty.JAVA_VERSION.value()); if (servlet) { String extra = ""; if (Strings.isNullOrEmpty(System.getProperty("glowroot.central.dir"))) { extra = ", this can be changed by adding the JVM arg -Dglowroot.central.dir=..." + " to your servlet container startup"; } startupLogger.info("Glowroot home: {}{}", centralDir.getAbsolutePath(), extra); } CentralConfiguration centralConfig = getCentralConfiguration(directories.getConfDir()); clusterManager = ClusterManager.create(directories.getConfDir(), centralConfig.jgroupsProperties()); session = connect(centralConfig); cluster = session.getCluster(); SchemaUpgrade schemaUpgrade = new SchemaUpgrade(session, clock, servlet); Integer initialSchemaVersion = schemaUpgrade.getInitialSchemaVersion(); if (initialSchemaVersion == null) { startupLogger.info("creating glowroot central schema..."); } else { schemaUpgrade.upgrade(); } if (schemaUpgrade.reloadCentralConfiguration()) { centralConfig = getCentralConfiguration(directories.getConfDir()); } repoAsyncExecutor = MoreExecutors2.newCachedThreadPool("Repo-Async-Worker-%d"); repos = new CentralRepoModule(clusterManager, session, directories.getConfDir(), centralConfig.cassandraSymmetricEncryptionKey(), repoAsyncExecutor, TARGET_MAX_ACTIVE_AGENTS_IN_PAST_7_DAYS, TARGET_MAX_CENTRAL_UI_USERS, clock); if (initialSchemaVersion == null) { schemaUpgrade.updateSchemaVersionToCurent(); startupLogger.info("glowroot central schema created"); } else { schemaUpgrade .updateToMoreRecentCassandraOptions(repos.getConfigRepository().getCentralStorageConfig()); } HttpClient httpClient = new HttpClient(repos.getConfigRepository()); LockSet<IncidentKey> openingIncidentLockSet = clusterManager .createReplicatedLockSet("openingIncidentLockSet", 60, SECONDS); LockSet<IncidentKey> resolvingIncidentLockSet = clusterManager .createReplicatedLockSet("resolvingIncidentLockSet", 60, SECONDS); alertingService = new AlertingService(repos.getConfigRepository(), repos.getIncidentDao(), repos.getAggregateDao(), repos.getGaugeValueDao(), repos.getTraceDao(), repos.getRollupLevelService(), new MailService(), httpClient, openingIncidentLockSet, resolvingIncidentLockSet, clock); HeartbeatAlertingService heartbeatAlertingService = new HeartbeatAlertingService( repos.getHeartbeatDao(), repos.getIncidentDao(), alertingService, repos.getConfigRepository()); centralAlertingService = new CentralAlertingService(repos.getConfigRepository(), alertingService, heartbeatAlertingService, repos.getAlertingDisabledDao(), clock); grpcServer = new GrpcServer(centralConfig.grpcBindAddress(), centralConfig.grpcHttpPort(), centralConfig.grpcHttpsPort(), directories.getConfDir(), repos.getAgentDisplayDao(), repos.getAgentConfigDao(), repos.getActiveAgentDao(), repos.getEnvironmentDao(), repos.getHeartbeatDao(), repos.getAggregateDao(), repos.getGaugeValueDao(), repos.getTraceDao(), repos.getV09AgentRollupDao(), centralAlertingService, clusterManager, clock, version); DownstreamServiceImpl downstreamService = grpcServer.getDownstreamService(); updateAgentConfigIfNeededService = new UpdateAgentConfigIfNeededService(repos.getAgentConfigDao(), repos.getActiveAgentDao(), downstreamService, clock); UpdateAgentConfigIfNeededService updateAgentConfigIfNeededServiceEffectivelyFinal = updateAgentConfigIfNeededService; repos.getConfigRepository().addAgentConfigListener(new AgentConfigListener() { @Override public void onChange(String agentId) throws Exception { // TODO report checker framework issue that occurs without checkNotNull checkNotNull(updateAgentConfigIfNeededServiceEffectivelyFinal) .updateAgentConfigIfNeededAndConnectedAsync(agentId); } }); rollupService = new RollupService(repos.getActiveAgentDao(), repos.getAggregateDao(), repos.getGaugeValueDao(), repos.getSyntheticResultDao(), centralAlertingService, clock); syntheticMonitorService = new SyntheticMonitorService(repos.getActiveAgentDao(), repos.getConfigRepository(), repos.getAlertingDisabledDao(), repos.getIncidentDao(), alertingService, repos.getSyntheticResultDao(), clusterManager, ticker, clock, version); ClusterManager clusterManagerEffectivelyFinal = clusterManager; uiModule = new CreateUiModuleBuilder().central(true).servlet(servlet).offlineViewer(false) .webPortReadOnly(false) // this only applies to embedded ui .bindAddress(centralConfig.uiBindAddress()).port(centralConfig.uiPort()) .https(centralConfig.uiHttps()).contextPath(centralConfig.uiContextPath()) .confDirs(Arrays.asList(directories.getConfDir())).logDir(directories.getLogDir()) .logFileNamePattern(Pattern.compile("glowroot-central.*\\.log")).clock(clock) .liveJvmService(new LiveJvmServiceImpl(downstreamService)) .agentDisplayRepository(repos.getAgentDisplayDao()) .configRepository(repos.getConfigRepository()) .alertingDisabledRepository(repos.getAlertingDisabledDao()) .activeAgentRepository(repos.getActiveAgentDao()) .environmentRepository(repos.getEnvironmentDao()) .transactionTypeRepository(repos.getTransactionTypeDao()) .traceAttributeNameRepository(repos.getTraceAttributeNameDao()) .traceRepository(repos.getTraceDao()).aggregateRepository(repos.getAggregateDao()) .gaugeValueRepository(repos.getGaugeValueDao()) .syntheticResultRepository(repos.getSyntheticResultDao()) .incidentRepository(repos.getIncidentDao()) .repoAdmin(new RepoAdminImpl(session, repos.getActiveAgentDao(), repos.getConfigRepository(), session.getCassandraWriteMetrics(), clock)) .rollupLevelService(repos.getRollupLevelService()) .liveTraceRepository(new LiveTraceRepositoryImpl(downstreamService)) .liveAggregateRepository(new LiveAggregateRepositoryNop()) .liveWeavingService(new LiveWeavingServiceImpl(downstreamService)) .sessionMapFactory(new SessionMapFactory() { @Override public <V extends /*@NonNull*/ Serializable> ConcurrentMap<String, V> create() { return clusterManagerEffectivelyFinal.createReplicatedMap("sessionMap"); } }).httpClient(httpClient).numWorkerThreads(50).version(version).build(); startupLogger.info("startup complete"); } catch (Throwable t) { if (startupLogger == null) { t.printStackTrace(); } else { startupLogger.error(t.getMessage(), t); } // try to shut down cleanly, otherwise apache commons daemon (via Procrun) doesn't // know service failed to start up if (uiModule != null) { uiModule.close(false); } if (syntheticMonitorService != null) { syntheticMonitorService.close(); } if (rollupService != null) { rollupService.close(); } if (updateAgentConfigIfNeededService != null) { updateAgentConfigIfNeededService.close(); } if (grpcServer != null) { grpcServer.close(false); } if (centralAlertingService != null) { centralAlertingService.close(); } if (alertingService != null) { alertingService.close(); } if (repos != null) { repos.close(); } if (repoAsyncExecutor != null) { repoAsyncExecutor.shutdown(); } if (session != null) { session.close(); } if (cluster != null) { cluster.close(); } if (clusterManager != null) { clusterManager.close(); } throw t; } this.clusterManager = clusterManager; this.cluster = cluster; this.session = session; this.repoAsyncExecutor = repoAsyncExecutor; this.repos = repos; this.alertingService = alertingService; this.centralAlertingService = centralAlertingService; this.grpcServer = grpcServer; this.updateAgentConfigIfNeededService = updateAgentConfigIfNeededService; this.rollupService = rollupService; this.syntheticMonitorService = syntheticMonitorService; this.uiModule = uiModule; }
From source file:net.shibboleth.idp.log.LogbackLoggingService.java
/** * Log the IdP version and Java version and vendor at INFO level. * /*from www . j a va 2 s . c om*/ * Log system properties defined by {@link StandardSystemProperty} at DEBUG level. */ protected void logImplementationDetails() { final Logger logger = LoggerFactory.getLogger(LogbackLoggingService.class); logger.info("Shibboleth IdP Version {}", Version.getVersion()); logger.info("Java version='{}' vendor='{}'", StandardSystemProperty.JAVA_VERSION.value(), StandardSystemProperty.JAVA_VENDOR.value()); if (logger.isDebugEnabled()) { for (StandardSystemProperty standardSystemProperty : StandardSystemProperty.values()) { logger.debug("{}", standardSystemProperty); } } }
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 ww.j a va 2 s . com*/ 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(); }
From source file:org.glowroot.central.CentralModule.java
static void createSchema() throws Exception { File centralDir = getCentralDir(); Directories directories = new Directories(centralDir); initLogging(directories.getConfDir(), directories.getLogDir()); String version = Version.getVersion(CentralModule.class); startupLogger.info("running create-schema command"); startupLogger.info("Glowroot version: {}", version); startupLogger.info("Java version: {}", StandardSystemProperty.JAVA_VERSION.value()); CentralConfiguration centralConfig = getCentralConfiguration(directories.getConfDir()); Session session = null;/*from w w w . jav a 2 s . c om*/ Cluster cluster = null; ExecutorService repoAsyncExecutor = null; CentralRepoModule repos = null; try { session = connect(centralConfig); cluster = session.getCluster(); SchemaUpgrade schemaUpgrade = new SchemaUpgrade(session, Clock.systemClock(), false); if (schemaUpgrade.getInitialSchemaVersion() != null) { startupLogger.error("glowroot central schema already exists, exiting"); return; } startupLogger.info("creating glowroot central schema..."); repoAsyncExecutor = MoreExecutors2.newCachedThreadPool("Repo-Async-Worker-%d"); repos = new CentralRepoModule(ClusterManager.create(), session, centralDir, centralConfig.cassandraSymmetricEncryptionKey(), repoAsyncExecutor, 10, 10, Clock.systemClock()); schemaUpgrade.updateSchemaVersionToCurent(); } finally { if (repos != null) { repos.close(); } if (repoAsyncExecutor != null) { repoAsyncExecutor.shutdown(); } if (session != null) { session.close(); } if (cluster != null) { cluster.close(); } } startupLogger.info("glowroot central schema created"); }