Java tutorial
//package com.java2s; import java.util.*; import java.util.concurrent.*; public class Main { /** * Gets ad hoc properties from a thread pool. * @return Ad hoc properties. */ public static Properties getProperties(ThreadPoolExecutor threadPoolExecutor) { Properties res = null; { if (threadPoolExecutor != null) { res = new Properties(); decorateProperties(threadPoolExecutor, res); } } return res; } /** * */ protected static void decorateProperties(ThreadPoolExecutor executor, Properties properties) { if (executor != null) { if (properties != null) { properties.setProperty("thread-keep-alive-time", Long.toString(executor.getKeepAliveTime(TimeUnit.MILLISECONDS))); properties.setProperty("thread-pool-size-largest", Integer.toString(executor.getLargestPoolSize())); properties.setProperty("thread-pool-size-minimum", Integer.toString(executor.getCorePoolSize())); properties.setProperty("thread-pool-size-maximum", Integer.toString(executor.getMaximumPoolSize())); properties.setProperty("thread-pool-size", Integer.toString(executor.getPoolSize())); properties.setProperty("runnable-completed-count", Long.toString(executor.getCompletedTaskCount())); properties.setProperty("runnable-active-count", Integer.toString(executor.getActiveCount())); properties.setProperty("queue-size", Integer.toString(executor.getQueue().size())); properties.setProperty("queue-capacity-remaining", Integer.toString(executor.getQueue().remainingCapacity())); } } } }