From 47c22d51ec5dce5fafdfd975358944eee8e0b4d7 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Fri, 9 Sep 2022 17:55:19 +0800 Subject: [PATCH] Print dynamic thread pool information --- .../starter/monitor/DynamicThreadPoolMonitorExecutor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java index d8808ddd..1bdecb95 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java @@ -20,6 +20,7 @@ package cn.hippo4j.config.springboot.starter.monitor; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.toolkit.StringUtil; import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.support.ThreadFactoryBuilder; import cn.hippo4j.common.spi.DynamicThreadPoolServiceLoader; import cn.hippo4j.monitor.base.DynamicThreadPoolMonitor; @@ -36,6 +37,8 @@ import java.util.List; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import static cn.hippo4j.core.executor.manage.GlobalThreadPoolManage.getThreadPoolNum; + /** * Dynamic thread-pool monitor executor. */ @@ -77,6 +80,9 @@ public class DynamicThreadPoolMonitorExecutor implements ApplicationRunner { properties.getInitialDelay(), properties.getCollectInterval(), TimeUnit.MILLISECONDS); + if (GlobalThreadPoolManage.getThreadPoolNum() > 0) { + log.info("Dynamic thread pool: [{}]. The dynamic thread pool starts data collection and reporting.", getThreadPoolNum()); + } } private void scheduleRunnable() {