List of usage examples for java.lang.management ThreadMXBean getPeakThreadCount
public int getPeakThreadCount();
From source file:net.bull.javamelody.internal.model.JavaInformations.java
public JavaInformations(ServletContext servletContext, boolean includeDetails) { // CHECKSTYLE:ON super();//from ww w.j av a 2 s. co m memoryInformations = new MemoryInformations(); tomcatInformationsList = TomcatInformations.buildTomcatInformationsList(); sessionCount = SessionListener.getSessionCount(); sessionAgeSum = SessionListener.getSessionAgeSum(); activeThreadCount = JdbcWrapper.getActiveThreadCount(); usedConnectionCount = JdbcWrapper.getUsedConnectionCount(); activeConnectionCount = JdbcWrapper.getActiveConnectionCount(); maxConnectionCount = JdbcWrapper.getMaxConnectionCount(); transactionCount = JdbcWrapper.getTransactionCount(); systemLoadAverage = buildSystemLoadAverage(); systemCpuLoad = buildSystemCpuLoad(); processCpuTimeMillis = buildProcessCpuTimeMillis(); unixOpenFileDescriptorCount = buildOpenFileDescriptorCount(); unixMaxFileDescriptorCount = buildMaxFileDescriptorCount(); host = Parameters.getHostName() + '@' + Parameters.getHostAddress(); os = buildOS(); availableProcessors = Runtime.getRuntime().availableProcessors(); javaVersion = System.getProperty("java.runtime.name") + ", " + System.getProperty("java.runtime.version"); jvmVersion = System.getProperty("java.vm.name") + ", " + System.getProperty("java.vm.version") + ", " + System.getProperty("java.vm.info"); if (servletContext == null) { serverInfo = null; contextPath = null; contextDisplayName = null; webappVersion = null; } else { serverInfo = servletContext.getServerInfo(); contextPath = Parameters.getContextPath(servletContext); contextDisplayName = servletContext.getServletContextName(); webappVersion = MavenArtifact.getWebappVersion(); } startDate = START_DATE; jvmArguments = buildJvmArguments(); final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); threadCount = threadBean.getThreadCount(); peakThreadCount = threadBean.getPeakThreadCount(); totalStartedThreadCount = threadBean.getTotalStartedThreadCount(); freeDiskSpaceInTemp = Parameters.TEMPORARY_DIRECTORY.getFreeSpace(); springBeanExists = SPRING_AVAILABLE && SpringContext.getSingleton() != null; if (includeDetails) { dataBaseVersion = buildDataBaseVersion(); dataSourceDetails = buildDataSourceDetails(); threadInformationsList = buildThreadInformationsList(); cacheInformationsList = CacheInformations.buildCacheInformationsList(); jobInformationsList = JobInformations.buildJobInformationsList(); pid = PID.getPID(); } else { dataBaseVersion = null; dataSourceDetails = null; threadInformationsList = null; cacheInformationsList = null; jobInformationsList = null; pid = null; } }
From source file:com.eurelis.opencms.admin.systeminformation.CmsCPUThreadsClassesOverviewDialog.java
/** * Initializes the infos object.<p> */// ww w. j a v a2 s . c o m protected void initInfosObject() { com.sun.management.OperatingSystemMXBean sunOsBean = (com.sun.management.OperatingSystemMXBean) ManagementFactory .getOperatingSystemMXBean(); java.lang.management.OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean(); java.lang.management.ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); java.lang.management.RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); java.lang.management.ClassLoadingMXBean classesBean = ManagementFactory.getClassLoadingMXBean(); setCpuCount("" + osBean.getAvailableProcessors()); double usage = com.eurelis.opencms.admin.systeminformation.CmsCPUThreadsClassesOverviewDialog .getCPUUsage(getSession()); usage = Math.round(usage * 100) / 100; setCpuUsage("" + 100 * usage + "%"); setLoadedClassesCount("" + classesBean.getLoadedClassCount()); setUnloadedClassesCount("" + classesBean.getUnloadedClassCount()); setTotalLoadedClassesCount("" + classesBean.getTotalLoadedClassCount()); setThreadsCount("" + threadBean.getThreadCount()); setThreadsStartedCount("" + threadBean.getTotalStartedThreadCount()); setThreadsPeakCount("" + threadBean.getPeakThreadCount()); setThreadsDaemonCount("" + threadBean.getDaemonThreadCount()); Object o; if (CmsStringUtil.isEmpty(getParamAction())) { o = new CmsAdminSettings(getSession()); } else { // this is not the initial call, get the job object from session o = getDialogObject(); } if (!(o instanceof CmsAdminSettings)) { // create a new history settings handler object m_adminSettings = new CmsAdminSettings(getSession()); } else { // reuse html import handler object stored in session m_adminSettings = (CmsAdminSettings) o; } setParamCloseLink(getJsp().link( "/system/workplace/views/admin/admin-main.jsp?path=/eurelis_system_information/cpu_and_threads.jsp")); }