optimize: 动态线程池刷新时打印线程池 ID.

pull/161/head
龙台 3 years ago
parent 50106d7c9e
commit 23fabc6ef1

@ -32,6 +32,7 @@ public class ThreadPoolDynamicRefresh {
public static void refreshDynamicPool(String threadPoolId, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Integer keepAliveTime, Integer rejectedType) { public static void refreshDynamicPool(String threadPoolId, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Integer keepAliveTime, Integer rejectedType) {
ThreadPoolExecutor executor = GlobalThreadPoolManage.getExecutorService(threadPoolId).getPool(); ThreadPoolExecutor executor = GlobalThreadPoolManage.getExecutorService(threadPoolId).getPool();
printLog("[🔥] Original thread pool. ", printLog("[🔥] Original thread pool. ",
threadPoolId,
executor.getCorePoolSize(), executor.getCorePoolSize(),
executor.getMaximumPoolSize(), executor.getMaximumPoolSize(),
queueType, queueType,
@ -43,6 +44,7 @@ public class ThreadPoolDynamicRefresh {
ThreadPoolExecutor afterExecutor = GlobalThreadPoolManage.getExecutorService(threadPoolId).getPool(); ThreadPoolExecutor afterExecutor = GlobalThreadPoolManage.getExecutorService(threadPoolId).getPool();
printLog("[🚀] Changed thread pool. ", printLog("[🚀] Changed thread pool. ",
threadPoolId,
afterExecutor.getCorePoolSize(), afterExecutor.getCorePoolSize(),
afterExecutor.getMaximumPoolSize(), afterExecutor.getMaximumPoolSize(),
queueType, queueType,
@ -51,8 +53,8 @@ public class ThreadPoolDynamicRefresh {
rejectedType); rejectedType);
} }
private static void printLog(String prefixMsg, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Long keepAliveTime, Integer rejectedType) { private static void printLog(String tpId, String prefixMsg, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Long keepAliveTime, Integer rejectedType) {
log.info("{} coreSize :: {}, maxSize :: {}, queueType :: {}, capacity :: {}, keepAliveTime :: {}, rejectedType:: {}", prefixMsg, coreSize, maxSize, queueType, capacity, keepAliveTime, rejectedType); log.info("{} :: {}, coreSize :: {}, maxSize :: {}, queueType :: {}, capacity :: {}, keepAliveTime :: {}, rejectedType:: {}", tpId, prefixMsg, coreSize, maxSize, queueType, capacity, keepAliveTime, rejectedType);
} }
public static void changePoolInfo(ThreadPoolExecutor executor, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Integer keepAliveTime, Integer rejectedType) { public static void changePoolInfo(ThreadPoolExecutor executor, Integer coreSize, Integer maxSize, Integer queueType, Integer capacity, Integer keepAliveTime, Integer rejectedType) {

Loading…
Cancel
Save