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