tpObj.put("active", threadPoolProxy.getActiveCount()); tpObj.put("pending", threadPoolProxy.getPendingTasks()); tpObj.put("completed", threadPoolProxy.getCompletedTasks()); tpObj.put("blocked", threadPoolProxy.getCurrentlyBlockedTasks()); tpObj.put("total blocked", threadPoolProxy.getTotalBlockedTasks());
@Override public void execute(NodeProbe probe) { System.out.printf("%-25s%10s%10s%15s%10s%18s%n", "Pool Name", "Active", "Pending", "Completed", "Blocked", "All time blocked"); Iterator<Map.Entry<String, JMXEnabledThreadPoolExecutorMBean>> threads = probe.getThreadPoolMBeanProxies(); while (threads.hasNext()) { Map.Entry<String, JMXEnabledThreadPoolExecutorMBean> thread = threads.next(); String poolName = thread.getKey(); JMXEnabledThreadPoolExecutorMBean threadPoolProxy = thread.getValue(); System.out.printf("%-25s%10s%10s%15s%10s%18s%n", poolName, threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks(), threadPoolProxy.getCurrentlyBlockedTasks(), threadPoolProxy.getTotalBlockedTasks()); } System.out.printf("%n%-20s%10s%n", "Message type", "Dropped"); for (Map.Entry<String, Integer> entry : probe.getDroppedMessages().entrySet()) System.out.printf("%-20s%10s%n", entry.getKey(), entry.getValue()); } }
/** * Get the status of all thread pools. * * @return thread pools info list */ public List<TPStatsInfo> getTPStats() { List<TPStatsInfo> tpstats = new ArrayList<>(); Iterator<Map.Entry<String, JMXEnabledThreadPoolExecutorMBean>> threads = nodeProbe.getThreadPoolMBeanProxies(); while (threads.hasNext()) { Map.Entry<String, JMXEnabledThreadPoolExecutorMBean> thread = threads.next(); JMXEnabledThreadPoolExecutorMBean threadPoolProxy = thread.getValue(); tpstats.add(new TPStatsInfo(thread.getKey(), threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks(), threadPoolProxy.getCurrentlyBlockedTasks(), threadPoolProxy.getTotalBlockedTasks())); } return tpstats; }
/** * Get the status of all thread pools. * * @return thread pools info list */ public List<TPStatsInfo> getTPStats() { List<TPStatsInfo> tpstats = new ArrayList<>(); Iterator<Map.Entry<String, JMXEnabledThreadPoolExecutorMBean>> threads = nodeProbe.getThreadPoolMBeanProxies(); while (threads.hasNext()) { Map.Entry<String, JMXEnabledThreadPoolExecutorMBean> thread = threads.next(); JMXEnabledThreadPoolExecutorMBean threadPoolProxy = thread.getValue(); tpstats.add(new TPStatsInfo(thread.getKey(), threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks(), threadPoolProxy.getCurrentlyBlockedTasks(), threadPoolProxy.getTotalBlockedTasks())); } return tpstats; }
threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks(), threadPoolProxy.getCurrentlyBlockedTasks(), threadPoolProxy.getTotalBlockedTasks()));