|
|
|
@ -220,17 +220,11 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner
|
|
|
|
|
AlarmNotifyRequest request = new AlarmNotifyRequest();
|
|
|
|
|
String appName = StrUtil.isBlank(itemId) ? applicationName : itemId;
|
|
|
|
|
request.setAppName(appName);
|
|
|
|
|
// 核心线程数
|
|
|
|
|
int corePoolSize = threadPoolExecutor.getCorePoolSize();
|
|
|
|
|
// 最大线程数
|
|
|
|
|
int maximumPoolSize = threadPoolExecutor.getMaximumPoolSize();
|
|
|
|
|
// 线程池当前线程数 (有锁)
|
|
|
|
|
int poolSize = threadPoolExecutor.getPoolSize();
|
|
|
|
|
// 活跃线程数 (有锁)
|
|
|
|
|
int activeCount = threadPoolExecutor.getActiveCount();
|
|
|
|
|
// 同时进入池中的最大线程数 (有锁)
|
|
|
|
|
int largestPoolSize = threadPoolExecutor.getLargestPoolSize();
|
|
|
|
|
// 线程池中执行任务总数量 (有锁)
|
|
|
|
|
long completedTaskCount = threadPoolExecutor.getCompletedTaskCount();
|
|
|
|
|
request.setActive(active.toUpperCase());
|
|
|
|
|
request.setIdentify(IdentifyUtil.getIdentify());
|
|
|
|
@ -241,13 +235,9 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner
|
|
|
|
|
request.setLargestPoolSize(largestPoolSize);
|
|
|
|
|
request.setCompletedTaskCount(completedTaskCount);
|
|
|
|
|
BlockingQueue<Runnable> queue = threadPoolExecutor.getQueue();
|
|
|
|
|
// 队列元素个数
|
|
|
|
|
int queueSize = queue.size();
|
|
|
|
|
// 队列类型
|
|
|
|
|
String queueType = queue.getClass().getSimpleName();
|
|
|
|
|
// 队列剩余容量
|
|
|
|
|
int remainingCapacity = queue.remainingCapacity();
|
|
|
|
|
// 队列容量
|
|
|
|
|
int queueCapacity = queueSize + remainingCapacity;
|
|
|
|
|
request.setQueueName(queueType);
|
|
|
|
|
request.setCapacity(queueCapacity);
|
|
|
|
|