@Override public JVMDetails getJVMDetails() { return JVMHelper.getDetails(); }
@Override public JVMStatistics getJVMStatistics() { return JVMHelper.getStatistics(); }
public double computeCpuPerc(JVMStatistics lastJVMStatistics) { // This object has been created by read external by a new client // The object itself has been serialized by and old (< 8.0.3) server if (lastJVMStatistics.getCpuTime() <= 0 || getCpuTime() <= 0) { return cpuPerc; } long timeDelta = getCpuTime() - lastJVMStatistics.getCpuTime(); long totalDelta = getCpuTotal() - lastJVMStatistics.getCpuTotal(); if (timeDelta <= 0 || totalDelta < 0) { return -1; } return ((double) totalDelta) / timeDelta; }
private static JVMStatisticsProbe initJVMStatisticsProbe() { String statisticsProbeClass = System.getProperty("gs.admin.jvm.probe.statistics"); if (statisticsProbeClass != null) return tryCreateInstance(statisticsProbeClass); try { JVMStatisticsProbe result = new SigarJVMStatisticsProbe(); result.probeStatistics(); return result; } catch (Throwable t) { LogHelper.log(_loggerName, Level.FINE, "Trying to load sigar failed", t); // ignore, no sigar } try { JVMStatisticsProbe result = new JMXJVMStatisticsProbe(); result.probeStatistics(); return result; } catch (Throwable t) { LogHelper.log(_loggerName, Level.FINE, "Trying to load JMX failed", t); // ignore, no sigar } return null; }
private static JVMDetailsProbe initJVMDetailsProbe() { String detailsProbeClass = System.getProperty("gs.admin.jvm.probe.details"); if (detailsProbeClass != null) return tryCreateInstance(detailsProbeClass); try { JVMDetailsProbe result = new SigarJVMDetailsProbe(); result.probeDetails(); return result; } catch (Throwable t) { LogHelper.log(_loggerName, Level.FINE, "Trying to load sigar failed", t); // ignore, no sigar } try { JVMDetailsProbe result = new JMXJVMDetailsProbe(); result.probeDetails(); return result; } catch (Throwable t) { LogHelper.log(_loggerName, Level.FINE, "Trying to load sigar failed", t); // ignore, no sigar } return null; }
@Override public void run() { RmiLoaderHandlerCleaner loaderHandlerCleaner = new RmiLoaderHandlerCleaner(); JVMStatistics jvmStats = JVMHelper.getStatistics(); while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(scheduledSystemBootTime); } catch (InterruptedException e) { break; } JVMStatistics newStats = JVMHelper.getStatistics(); long collectionTime = newStats.getGcCollectionTime() - jvmStats.getGcCollectionTime(); if (collectionTime > gcCollectionWarning) { logger.warning("Long GC collection occurred, took [" + collectionTime + "ms], breached threshold [" + gcCollectionWarning + "]"); } jvmStats = newStats; if (loadCleanerEnabled) { loaderHandlerCleaner.clean(); } exitIfHasAgentAndAgentIsNotRunning(); } } };
public void writeExternal(ObjectOutput out) throws IOException { final PlatformLogicalVersion version = LRMIInvocationContext.getEndpointLogicalVersion(); if (version.greaterOrEquals(PlatformLogicalVersion.v9_1_1)) { writeExternal9_1_1(out); } else { writeExternal9_1_0(out); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { final PlatformLogicalVersion version = LRMIInvocationContext.getEndpointLogicalVersion(); if (version.greaterOrEquals(PlatformLogicalVersion.v9_1_1)) { readExternal9_1_1(in); } else { readExternal9_1_0(in); } }
public static boolean isJMXRemotePortDefined(ServiceItem serviceItem) { Boolean isJmxRemoteAuthenticationRequired = false; if (serviceItem.service instanceof JVMInfoProvider) { JVMInfoProvider jvmInfoProvider = (JVMInfoProvider) serviceItem.service; ServiceID serviceId = serviceItem.serviceID; try { isJmxRemoteAuthenticationRequired = jmxRemotePortDefiedMap.get(serviceId); if (isJmxRemoteAuthenticationRequired == null) { JVMDetails jvmDetails = jvmInfoProvider.getJVMDetails(); Map<String, String> vmSystemProperties = jvmDetails.getSystemProperties(); isJmxRemoteAuthenticationRequired = vmSystemProperties.get(SystemProperties.JMX_REMOTE_PORT) != null && vmSystemProperties.get(SystemProperties.JMX_REMOTE_AUTHENTICATE) != null && Boolean.parseBoolean(vmSystemProperties.get(SystemProperties.JMX_REMOTE_AUTHENTICATE)); jmxRemotePortDefiedMap.put(serviceId, isJmxRemoteAuthenticationRequired); } } catch (RemoteException e) { if (_logger.isLoggable(Level.SEVERE)) { _logger.log(Level.SEVERE, e.toString(), e); } } } return isJmxRemoteAuthenticationRequired; }
public JVMDetails(String uid, String vmName, String vmVersion, String vmVendor, long startTime, long memoryHeapInit, long memoryHeapMax, long memoryNonHeapInit, long memoryNonHeapMax, String[] inputArguments, String bootClassPath, String classPath, Map<String, String> systemProperties, Map<String, String> environmentVariables, long pid) { this.uid = uid; this.vmName = vmName; this.vmVersion = vmVersion; this.vmVendor = vmVendor; this.startTime = startTime; this.memoryHeapInit = memoryHeapInit; this.memoryHeapMax = memoryHeapMax; this.memoryNonHeapInit = memoryNonHeapInit; this.memoryNonHeapMax = memoryNonHeapMax; this.inputArguments = inputArguments; this.bootClassPath = bootClassPath; this.classPath = classPath; this.systemProperties = systemProperties; this.environmentVariables = filterByPrefix(environmentVariables); this.pid = pid; }
@Override public JVMDetails getJVMDetails() throws RemoteException { if (jvmDetails != null) { return jvmDetails; } jvmDetails = ((JVMInfoProvider) getProxy()).getJVMDetails(); return jvmDetails; }
public static JVMStatistics getStatistics() { if (_statisticsProbe == null) return NA_STATISTICS; try { return _statisticsProbe.probeStatistics(); } catch (Exception e) { LogHelper.log(_loggerName, Level.FINE, "Failed to get stats", e); return NA_STATISTICS; } }
@Override public JVMStatistics getJVMStatistics() throws RemoteException { return ((JVMInfoProvider) getProxy()).getJVMStatistics(); }
public static JVMDetails getDetails() { if (_detailsProbe == null) return NA_DETAILS; try { if (details != null) return details; details = _detailsProbe.probeDetails(); return details; } catch (Exception e) { LogHelper.log(_loggerName, Level.FINE, "Failed to get configuration", e); return NA_DETAILS; } }
@Override public void runGc() throws RemoteException { ((JVMInfoProvider) getProxy()).runGc(); }
public static void main(String[] args) { try { String request = args.length != 0 ? args[0].toLowerCase() : "version"; switch (request) { case "version": System.out.println(JavaUtils.getMajorJavaVersion()); break; default: System.out.println("Unsupported: [" + request + "]"); break; } } catch (Exception e) { System.out.println("Error: " + e); e.printStackTrace(); System.exit(1); } }
public LookupDiscoveryManager( String[] groups, LookupLocator[] locators, DiscoveryListener listener, Configuration config, boolean runningWithinRegistrar) throws IOException, ConfigurationException { // GS-10816 This must be called outside of the LogManager lock (meaning before RollingFileHandler() is invoked) // The LookupDiscoveryManager is the first code that is executed by the Admin / SpaceProxy // before a call to any logger. JVMHelper.initStaticCotr(); beginDiscovery(groups, locators, listener, config); dynamicLocatorDisc = new DynamicLookupLocatorDiscovery(this, runningWithinRegistrar); }
public JVMDetails probeDetails() { return new JVMDetails(uid, runtimeMXBean.getVmName(), System.getProperty("java.version"), System.getProperty("java.vendor"), runtimeMXBean.getStartTime(), memoryMXBean.getHeapMemoryUsage().getInit(), memoryMXBean.getHeapMemoryUsage().getMax(), memoryMXBean.getNonHeapMemoryUsage().getInit(), memoryMXBean.getNonHeapMemoryUsage().getMax(), runtimeMXBean.getInputArguments().toArray(new String[0]), runtimeMXBean.isBootClassPathSupported() ? runtimeMXBean.getBootClassPath() : "", runtimeMXBean.getClassPath(), runtimeMXBean.getSystemProperties(), System.getenv(), pid); } }
public JVMStatistics getJVMStatistics() throws RemoteException { return JVMHelper.getStatistics(); }
public JVMDetails getJVMDetails() throws RemoteException { return JVMHelper.getDetails(); }