Example usage for java.lang.management ThreadMXBean getTotalStartedThreadCount

List of usage examples for java.lang.management ThreadMXBean getTotalStartedThreadCount

Introduction

In this page you can find the example usage for java.lang.management ThreadMXBean getTotalStartedThreadCount.

Prototype

public long getTotalStartedThreadCount();

Source Link

Document

Returns the total number of threads created and also started since the Java virtual machine started.

Usage

From source file:com.amazonaws.client.metrics.support.JmxInfoProviderSupport.java

@Override
public long getTotalStartedThreadCount() {
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    return threadMXBean.getTotalStartedThreadCount();
}

From source file:com.thoughtworks.go.server.service.support.ThreadInformationProvider.java

private Map<String, Object> getThreadCount(ThreadMXBean threadMXBean) {
    LinkedHashMap<String, Object> count = new LinkedHashMap<>();
    count.put("Current", threadMXBean.getThreadCount());
    count.put("Total", threadMXBean.getTotalStartedThreadCount());
    count.put("Daemon", threadMXBean.getDaemonThreadCount());
    count.put("Peak", threadMXBean.getPeakThreadCount());
    return count;
}

From source file:com.thoughtworks.go.server.service.support.ServerRuntimeInformationProvider.java

private void threadInfo(ThreadMXBean threadMXBean, InformationStringBuilder builder) {
    builder.addSection("Thread information");

    builder.append(String.format("Current: %s, Total: %s, Daemon: %s, Peak: %s\n",
            threadMXBean.getThreadCount(), threadMXBean.getTotalStartedThreadCount(),
            threadMXBean.getDaemonThreadCount(), threadMXBean.getPeakThreadCount()));
    long[] deadlockedThreads = threadMXBean.findDeadlockedThreads();
    if (deadlockedThreads != null && deadlockedThreads.length > 0) {
        builder.append(String.format("Found %s dead locked threads. Here is there information.\n",
                deadlockedThreads.length));
        for (long deadlockedThread : deadlockedThreads) {
            ThreadInfo threadInfo = threadMXBean.getThreadInfo(deadlockedThread);
            LockInfo lockInfo = threadInfo.getLockInfo();
            if (lockInfo != null) {
                builder.append(String.format("LockInfo: %s", lockInfo));
            } else {
                builder.append("This thread is not waiting for any locks\n");
            }//ww w  .  j  av  a2 s  .c o  m
            builder.append(String.format("Monitor Info - Stack Frame where locks were taken.\n"));
            MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
            for (MonitorInfo lockedMonitor : lockedMonitors) {
                builder.append(String.format("Monitor for class '%s' taken at stack frame '%s'.",
                        lockedMonitor.getClassName(), lockedMonitor.getLockedStackFrame()));
            }
            builder.append("The stack trace of the deadlocked thread\n");
            builder.append(Arrays.toString(threadInfo.getStackTrace()));
        }
    }
    builder.addSubSection("All thread stacktraces");
    ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true);
    for (ThreadInfo threadInfo : threadInfos) {
        builder.append(String.format("%s, %s, %s\n", threadInfo.getThreadId(), threadInfo.getThreadName(),
                threadInfo.getThreadState()));
        MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
        builder.append("Locked Monitors:\n");
        for (MonitorInfo lockedMonitor : lockedMonitors) {
            builder.append(String.format("%s at %s", lockedMonitor, lockedMonitor.getLockedStackFrame()));
        }
        LockInfo[] lockedSynchronizers = threadInfo.getLockedSynchronizers();
        builder.append("Locked Synchronizers:\n");
        for (LockInfo lockedSynchronizer : lockedSynchronizers) {
            builder.append(lockedSynchronizer);
        }
        builder.append("Stacktrace:\n  ");
        builder.append(StringUtils.join(threadInfo.getStackTrace(), "\n  "));
        builder.append("\n\n");
    }
}

From source file:com.thoughtworks.go.server.service.support.ThreadInformationProvider.java

@Override
public void appendInformation(InformationStringBuilder builder) {
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    builder.addSection("Thread information");

    builder.append(String.format("Current: %s, Total: %s, Daemon: %s, Peak: %s\n",
            threadMXBean.getThreadCount(), threadMXBean.getTotalStartedThreadCount(),
            threadMXBean.getDaemonThreadCount(), threadMXBean.getPeakThreadCount()));
    long[] deadlockedThreads = threadMXBean.findDeadlockedThreads();
    if (deadlockedThreads != null && deadlockedThreads.length > 0) {
        builder.append(String.format("Found %s dead locked threads. Here is there information.\n",
                deadlockedThreads.length));
        for (long deadlockedThread : deadlockedThreads) {
            ThreadInfo threadInfo = threadMXBean.getThreadInfo(deadlockedThread);
            LockInfo lockInfo = threadInfo.getLockInfo();
            if (lockInfo != null) {
                builder.append(String.format("LockInfo: %s", lockInfo));
            } else {
                builder.append("This thread is not waiting for any locks\n");
            }//  ww  w  .  j  a va 2  s .c  o  m
            builder.append(String.format("Monitor Info - Stack Frame where locks were taken.\n"));
            MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
            for (MonitorInfo lockedMonitor : lockedMonitors) {
                builder.append(String.format("Monitor for class '%s' taken at stack frame '%s'.",
                        lockedMonitor.getClassName(), lockedMonitor.getLockedStackFrame()));
            }
            builder.append("The stack trace of the deadlocked thread\n");
            builder.append(Arrays.toString(threadInfo.getStackTrace()));
        }
    }
    builder.addSubSection("All thread stacktraces");
    ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true);
    for (ThreadInfo threadInfo : threadInfos) {
        builder.append(String.format("%s, %s, %s\n", threadInfo.getThreadId(), threadInfo.getThreadName(),
                threadInfo.getThreadState()));
        MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
        builder.append("Locked Monitors:\n");
        for (MonitorInfo lockedMonitor : lockedMonitors) {
            builder.append(String.format("%s at %s", lockedMonitor, lockedMonitor.getLockedStackFrame()));
        }
        LockInfo[] lockedSynchronizers = threadInfo.getLockedSynchronizers();
        builder.append("Locked Synchronizers:\n");
        for (LockInfo lockedSynchronizer : lockedSynchronizers) {
            builder.append(lockedSynchronizer);
        }
        builder.append("Stacktrace:\n  ");
        builder.append(StringUtils.join(threadInfo.getStackTrace(), "\n  "));
        builder.append("\n\n");
    }
}

From source file:ca.simplegames.micro.controllers.StatsController.java

public void execute(MicroContext context, Map configuration) throws ControllerException {
    Map<String, Object> systemInfo = new HashMap<String, Object>();
    Map<String, Object> osMap = new HashMap<String, Object>();
    MBeanServerConnection mbeanServer = ManagementFactory.getPlatformMBeanServer();

    OperatingSystemMXBean sunOperatingSystemMXBean = null;
    try {//  www  . j a  v  a  2s .  c  o m
        sunOperatingSystemMXBean = ManagementFactory.newPlatformMXBeanProxy(mbeanServer,
                ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class);
    } catch (IOException e) {
        throw new ControllerException(e.getMessage());
    }

    Runtime rt = Runtime.getRuntime();
    long totalMemory = rt.totalMemory() / MEGA_BYTE;
    long freeMemory = rt.freeMemory() / MEGA_BYTE;
    long usedMemory = totalMemory - freeMemory;

    final long p100 = (int) Math.round(((double) freeMemory / (double) totalMemory) * 100);

    Map<String, Long> memInfo = new HashMap<String, Long>();

    memInfo.put("total", totalMemory);
    memInfo.put("used", usedMemory);
    memInfo.put("free", freeMemory);
    memInfo.put("percent_free", p100);

    systemInfo.put("memory", memInfo);
    systemInfo.put("powered_by", POWERED_BY_MICRO);

    //cpu usage in milli secs
    long currentCpuUsage = sunOperatingSystemMXBean.getProcessCpuTime() / 1000000;
    osMap.put("cpu_usage", currentCpuUsage);
    osMap.put("available_processors", sunOperatingSystemMXBean.getAvailableProcessors());
    osMap.put("system_load_average", sunOperatingSystemMXBean.getSystemLoadAverage());
    osMap.put("committed_virtual_memory_size", sunOperatingSystemMXBean.getCommittedVirtualMemorySize());
    osMap.put("free_physical_memory_size", sunOperatingSystemMXBean.getFreePhysicalMemorySize());
    osMap.put("total_physical_memory_size", sunOperatingSystemMXBean.getTotalPhysicalMemorySize());
    osMap.put("free_swap_space_size", sunOperatingSystemMXBean.getFreeSwapSpaceSize());
    osMap.put("total_swap_space_size", sunOperatingSystemMXBean.getTotalSwapSpaceSize());

    systemInfo.put("os", osMap);

    List<GarbageCollectorMXBean> gc = ManagementFactory.getGarbageCollectorMXBeans();
    List<Map> gcInfo = new ArrayList<Map>();

    for (GarbageCollectorMXBean aGc : gc) {
        Map<String, Object> gcMap = new HashMap<String, Object>();
        gcMap.put("name", aGc.getName());
        gcMap.put("collection_count", aGc.getCollectionCount());
        gcMap.put("collection_time", aGc.getCollectionTime());

        gcInfo.add(gcMap);
    }

    systemInfo.put("gc", gcInfo);

    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
    Map<String, Object> threadInfoMap = new HashMap<String, Object>(); // more to come ;)
    threadInfoMap.put("peak_thread_count", threadMXBean.getPeakThreadCount());
    threadInfoMap.put("thread_count", threadMXBean.getThreadCount());
    threadInfoMap.put("total_started_thread_count", threadMXBean.getTotalStartedThreadCount());

    long[] deadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
    threadInfoMap.put("dead_locked_thread_count", deadlockedThreads != null ? deadlockedThreads.length : 0);
    systemInfo.put("thread_info", threadInfoMap);

    JSONObject sysinfoJson = new JSONObject(Collections.singletonMap("system_info", systemInfo));

    String sysinfoString = null;
    try {
        sysinfoString = context.getRequest().getParameter("pretty") != null ? sysinfoJson.toString(2)
                : sysinfoJson.toString();
    } catch (JSONException e) {
        e.printStackTrace();
        throw new ControllerException(e.getMessage());
    }

    context.getRackResponse().withContentType(Mime.mimeType(JSON_TYPE)).withBody(sysinfoString)
            .withContentLength(sysinfoString.length()).with(Rack.MESSAGE_STATUS, HttpServletResponse.SC_OK);

    context.halt();
}

From source file:org.eclipse.gyrex.cloud.internal.NodeMetricsReporter.java

@Override
protected IStatus run(final IProgressMonitor monitor) {
    if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
    }/*from  w  ww .  j  av a2 s  . co  m*/

    try {
        final Properties metrics = new Properties() {
            private static final long serialVersionUID = 1L;

            @Override
            public synchronized Enumeration<Object> keys() {
                return Collections.enumeration(keySet());
            }

            @Override
            public Set<Object> keySet() {
                return new TreeSet<Object>(super.keySet());
            }
        };
        final OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
        metrics.setProperty("os.availableProcessors",
                String.valueOf(operatingSystemMXBean.getAvailableProcessors()));
        metrics.setProperty("os.systemLoadAverage",
                String.valueOf(operatingSystemMXBean.getSystemLoadAverage()));
        metrics.setProperty("os.committedVirtualMemorySize",
                getUsingReflection(operatingSystemMXBean, "getCommittedVirtualMemorySize"));
        metrics.setProperty("os.totalSwapSpaceSize",
                getUsingReflection(operatingSystemMXBean, "getTotalSwapSpaceSize"));
        metrics.setProperty("os.freeSwapSpaceSize",
                getUsingReflection(operatingSystemMXBean, "getFreeSwapSpaceSize"));
        metrics.setProperty("os.processCpuTime",
                getUsingReflection(operatingSystemMXBean, "getProcessCpuTime"));
        metrics.setProperty("os.freePhysicalMemorySize",
                getUsingReflection(operatingSystemMXBean, "getFreePhysicalMemorySize"));
        metrics.setProperty("os.totalPhysicalMemorySize",
                getUsingReflection(operatingSystemMXBean, "getTotalPhysicalMemorySize"));
        metrics.setProperty("os.openFileDescriptorCount",
                getUsingReflection(operatingSystemMXBean, "getOpenFileDescriptorCount"));
        metrics.setProperty("os.maxFileDescriptorCount",
                getUsingReflection(operatingSystemMXBean, "getMaxFileDescriptorCount"));

        final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
        final MemoryUsage heapMemoryUsage = memoryMXBean.getHeapMemoryUsage();
        metrics.setProperty("heap.used", String.valueOf(heapMemoryUsage.getUsed()));
        metrics.setProperty("heap.committed", String.valueOf(heapMemoryUsage.getCommitted()));
        metrics.setProperty("heap.max", String.valueOf(heapMemoryUsage.getMax()));
        metrics.setProperty("heap.init", String.valueOf(heapMemoryUsage.getInit()));
        final MemoryUsage nonHeapMemoryUsage = memoryMXBean.getNonHeapMemoryUsage();
        metrics.setProperty("nonHeap.used", String.valueOf(nonHeapMemoryUsage.getUsed()));
        metrics.setProperty("nonHeap.committed", String.valueOf(nonHeapMemoryUsage.getCommitted()));
        metrics.setProperty("nonHeap.max", String.valueOf(nonHeapMemoryUsage.getMax()));
        metrics.setProperty("nonHeap.init", String.valueOf(nonHeapMemoryUsage.getInit()));

        final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        metrics.setProperty("thread.count", String.valueOf(threadMXBean.getThreadCount()));
        metrics.setProperty("thread.peak", String.valueOf(threadMXBean.getPeakThreadCount()));
        metrics.setProperty("thread.totalStarted", String.valueOf(threadMXBean.getTotalStartedThreadCount()));

        final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
        metrics.setProperty("uptime", String.valueOf(runtimeMXBean.getUptime()));

        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final NodeInfo nodeInfo = CloudState.getNodeInfo();
        metrics.store(out, String.valueOf(nodeInfo));
        ZooKeeperGate.get().writeRecord(IZooKeeperLayout.PATH_NODES_METRICS.append(nodeInfo.getNodeId()),
                CreateMode.PERSISTENT, out.toByteArray());
        if (CloudDebug.nodeMetrics) {
            LOG.debug("Node metrics reported successfully.{}{}", SystemUtils.LINE_SEPARATOR,
                    new String(out.toByteArray(), CharEncoding.ISO_8859_1));
        }
    } catch (final Exception e) {
        LOG.warn("Failed to update node metrics. {}", e.getMessage());
    } finally {
        // reschedule
        schedule(DELAY);
    }

    return Status.OK_STATUS;
}

From source file:net.bull.javamelody.internal.model.JavaInformations.java

public JavaInformations(ServletContext servletContext, boolean includeDetails) {
    // CHECKSTYLE:ON
    super();/*w  ww .  java2 s  . c o 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>
 *///  w w w .j  a v a2  s  .  co  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"));

}

From source file:edu.usu.sdl.openstorefront.web.rest.service.Application.java

@GET
@RequireAdmin/*w w w .ja  v  a  2  s . c om*/
@APIDescription("Gets the application system status")
@Produces({ MediaType.APPLICATION_JSON })
@DataType(ApplicationStatus.class)
@Path("/status")
public Response getApplicationStatus() {
    OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
    MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
    List<MemoryPoolMXBean> memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans();
    ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();

    ApplicationStatus applicationStatus = new ApplicationStatus();
    applicationStatus.setApplicationVersion(PropertiesManager.getApplicationVersion());
    applicationStatus.setProcessorCount(operatingSystemMXBean.getAvailableProcessors());
    applicationStatus.setSystemLoad(operatingSystemMXBean.getSystemLoadAverage());
    applicationStatus.setSystemProperties(runtimeMXBean.getSystemProperties());

    applicationStatus.getHeapMemoryStatus().setName("Heap");
    applicationStatus.getHeapMemoryStatus().setDetails(memoryMXBean.getHeapMemoryUsage().toString());
    applicationStatus.getHeapMemoryStatus()
            .setInitKb(memoryMXBean.getHeapMemoryUsage().getInit() != 0
                    ? memoryMXBean.getHeapMemoryUsage().getInit() / 1024
                    : 0);
    applicationStatus.getHeapMemoryStatus()
            .setUsedKb(memoryMXBean.getHeapMemoryUsage().getUsed() != 0
                    ? memoryMXBean.getHeapMemoryUsage().getUsed() / 1024
                    : 0);
    applicationStatus.getHeapMemoryStatus()
            .setMaxKb(memoryMXBean.getHeapMemoryUsage().getMax() != 0
                    ? memoryMXBean.getHeapMemoryUsage().getMax() / 1024
                    : 0);
    applicationStatus.getHeapMemoryStatus()
            .setCommitedKb(memoryMXBean.getHeapMemoryUsage().getCommitted() != 0
                    ? memoryMXBean.getHeapMemoryUsage().getCommitted() / 1024
                    : 0);

    applicationStatus.getNonHeapMemoryStatus().setName("Non-Heap");
    applicationStatus.getNonHeapMemoryStatus().setDetails(memoryMXBean.getNonHeapMemoryUsage().toString());
    applicationStatus.getNonHeapMemoryStatus()
            .setInitKb(memoryMXBean.getNonHeapMemoryUsage().getInit() != 0
                    ? memoryMXBean.getNonHeapMemoryUsage().getInit() / 1024
                    : 0);
    applicationStatus.getNonHeapMemoryStatus()
            .setUsedKb(memoryMXBean.getNonHeapMemoryUsage().getUsed() != 0
                    ? memoryMXBean.getNonHeapMemoryUsage().getUsed() / 1024
                    : 0);
    applicationStatus.getNonHeapMemoryStatus()
            .setMaxKb(memoryMXBean.getNonHeapMemoryUsage().getMax() != 0
                    ? memoryMXBean.getNonHeapMemoryUsage().getMax() / 1024
                    : 0);
    applicationStatus.getNonHeapMemoryStatus()
            .setCommitedKb(memoryMXBean.getNonHeapMemoryUsage().getCommitted() != 0
                    ? memoryMXBean.getNonHeapMemoryUsage().getCommitted() / 1024
                    : 0);

    applicationStatus.setLiveThreadCount(threadMXBean.getThreadCount());
    applicationStatus.setTotalThreadCount(threadMXBean.getTotalStartedThreadCount());

    applicationStatus.setStartTime(new Date(runtimeMXBean.getStartTime()));
    applicationStatus.setUpTime(TimeUtil.millisToString(runtimeMXBean.getUptime()));

    for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) {
        applicationStatus.getGarbageCollectionInfos()
                .add(TimeUtil.millisToString(garbageCollectorMXBean.getCollectionTime()) + " - ("
                        + garbageCollectorMXBean.getCollectionCount() + ")");
    }

    for (MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeans) {
        MemoryPoolStatus memoryPoolStatus = new MemoryPoolStatus();
        memoryPoolStatus.setName(memoryPoolMXBean.getName() + " - " + memoryPoolMXBean.getType());
        memoryPoolStatus.setDetails(memoryPoolMXBean.getUsage().toString());
        memoryPoolStatus.setInitKb(
                memoryPoolMXBean.getUsage().getInit() != 0 ? memoryPoolMXBean.getUsage().getInit() / 1024 : 0);
        memoryPoolStatus.setUsedKb(
                memoryPoolMXBean.getUsage().getUsed() != 0 ? memoryPoolMXBean.getUsage().getUsed() / 1024 : 0);
        memoryPoolStatus.setMaxKb(
                memoryPoolMXBean.getUsage().getMax() != 0 ? memoryPoolMXBean.getUsage().getMax() / 1024 : 0);
        memoryPoolStatus.setCommitedKb(memoryPoolMXBean.getUsage().getCommitted() != 0
                ? memoryPoolMXBean.getUsage().getCommitted() / 1024
                : 0);

        applicationStatus.getMemoryPools().add(memoryPoolStatus);
    }

    return sendSingleEntityResponse(applicationStatus);
}