Change thread pool dynamic change style

1.4.1
chen.ma 2 years ago
parent 47c22d51ec
commit 2aa60694f2

@ -35,14 +35,14 @@ hippo4j/hippo4j-server
观察 Hippo4j-Example 控制台日志输出,日志输出包括不限于此信息即为成功。 观察 Hippo4j-Example 控制台日志输出,日志输出包括不限于此信息即为成功。
```tex ```tex
2022-08-13 21:26:25.814 INFO 38972 --- [change.config-5] c.h.s.s.c.ServerThreadPoolDynamicRefresh : [message-consume] Dynamic thread pool change parameter. 2022-09-10 00:23:29.783 INFO 50322 --- [change.config_0] c.h.s.s.c.ServerThreadPoolDynamicRefresh : [message-consume] Dynamic thread pool change parameter.
corePoolSize: [5 => 5] corePoolSize: 2 => 4
maximumPoolSize: [6 => 7] maximumPoolSize: 6 => 12
capacity: [10 => 10] capacity: 1024 => 2048
keepAliveTime: [3 => 3] keepAliveTime: 9999 => 9999
executeTimeOut: [0 => 0] executeTimeOut: 800 => 3000
rejectedType: [CustomErrorLogRejectedExecutionHandler => CustomErrorLogRejectedExecutionHandler] rejectedType: SyncPutQueuePolicy => RunsOldestTaskPolicy
allowCoreThreadTimeOut: [false => false] allowCoreThreadTimeOut: true => true
``` ```
另外,当 Client 集群部署时,可以修改某一个实例,或选择 `全部修改` 按钮,修改所有实例线程池信息。 另外,当 Client 集群部署时,可以修改某一个实例,或选择 `全部修改` 按钮,修改所有实例线程池信息。

@ -89,7 +89,7 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService {
Integer maxSize = threadPoolParameterInfo.maximumPoolSizeAdapt(); Integer maxSize = threadPoolParameterInfo.maximumPoolSizeAdapt();
jettyExecutor.setMinThreads(coreSize); jettyExecutor.setMinThreads(coreSize);
jettyExecutor.setMaxThreads(maxSize); jettyExecutor.setMaxThreads(maxSize);
log.info("[Jetty] Changed web thread pool. corePoolSize: [{}], maximumPoolSize: [{}]", log.info("[Jetty] Changed web thread pool. corePoolSize: {}, maximumPoolSize: {}",
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, minThreads, jettyExecutor.getMinThreads()), String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, minThreads, jettyExecutor.getMinThreads()),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, maxThreads, jettyExecutor.getMaxThreads())); String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, maxThreads, jettyExecutor.getMaxThreads()));
} catch (Exception ex) { } catch (Exception ex) {

@ -156,7 +156,7 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
tomcatThreadPoolExecutor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt()); tomcatThreadPoolExecutor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt());
tomcatThreadPoolExecutor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt()); tomcatThreadPoolExecutor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt());
tomcatThreadPoolExecutor.setKeepAliveTime(threadPoolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS); tomcatThreadPoolExecutor.setKeepAliveTime(threadPoolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS);
log.info("[Tomcat] Changed web thread pool. corePoolSize: [{}], maximumPoolSize: [{}], keepAliveTime: [{}]", log.info("[Tomcat] Changed web thread pool. corePoolSize: {}, maximumPoolSize: {}, keepAliveTime: {}",
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalCoreSize, threadPoolParameterInfo.corePoolSizeAdapt()), String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalCoreSize, threadPoolParameterInfo.corePoolSizeAdapt()),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalMaximumPoolSize, threadPoolParameterInfo.maximumPoolSizeAdapt()), String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalMaximumPoolSize, threadPoolParameterInfo.maximumPoolSizeAdapt()),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, threadPoolParameterInfo.getKeepAliveTime())); String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, threadPoolParameterInfo.getKeepAliveTime()));

@ -146,7 +146,7 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService {
xnioWorker.setOption(Options.WORKER_TASK_CORE_THREADS, coreSize); xnioWorker.setOption(Options.WORKER_TASK_CORE_THREADS, coreSize);
xnioWorker.setOption(Options.WORKER_TASK_MAX_THREADS, maxSize); xnioWorker.setOption(Options.WORKER_TASK_MAX_THREADS, maxSize);
xnioWorker.setOption(Options.WORKER_TASK_KEEPALIVE, keepAliveTime); xnioWorker.setOption(Options.WORKER_TASK_KEEPALIVE, keepAliveTime);
log.info("[Undertow] Changed web thread pool. corePoolSize: [{}], maximumPoolSize: [{}], keepAliveTime: [{}]", log.info("[Undertow] Changed web thread pool. corePoolSize: {}, maximumPoolSize: {}, keepAliveTime: {}",
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalCoreSize, coreSize), String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalCoreSize, coreSize),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalMaximumPoolSize, maxSize), String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalMaximumPoolSize, maxSize),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, keepAliveTime)); String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, keepAliveTime));

@ -26,13 +26,13 @@ public class ChangeThreadPoolConstants {
* Dynamic thread pool parameter change text * Dynamic thread pool parameter change text
*/ */
public static final String CHANGE_THREAD_POOL_TEXT = "[{}] Dynamic thread pool change parameter." + public static final String CHANGE_THREAD_POOL_TEXT = "[{}] Dynamic thread pool change parameter." +
"\n corePoolSize: [{}]" + "\n corePoolSize: {}" +
"\n maximumPoolSize: [{}]" + "\n maximumPoolSize: {}" +
"\n capacity: [{}]" + "\n capacity: {}" +
"\n keepAliveTime: [{}]" + "\n keepAliveTime: {}" +
"\n executeTimeOut: [{}]" + "\n executeTimeOut: {}" +
"\n rejectedType: [{}]" + "\n rejectedType: {}" +
"\n allowCoreThreadTimeOut: [{}]"; "\n allowCoreThreadTimeOut: {}";
/** /**
* Dynamic thread pool parameter change separator * Dynamic thread pool parameter change separator

Loading…
Cancel
Save