Skip to content

Commit

Permalink
Change thread pool dynamic change style
Browse files Browse the repository at this point in the history
  • Loading branch information
magestacks committed Sep 9, 2022
1 parent 47c22d5 commit 2aa6069
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions docs/docs/user_docs/user_guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ hippo4j/hippo4j-server
观察 Hippo4j-Example 控制台日志输出,日志输出包括不限于此信息即为成功。

```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.
corePoolSize: [5 => 5]
maximumPoolSize: [6 => 7]
capacity: [10 => 10]
keepAliveTime: [3 => 3]
executeTimeOut: [0 => 0]
rejectedType: [CustomErrorLogRejectedExecutionHandler => CustomErrorLogRejectedExecutionHandler]
allowCoreThreadTimeOut: [false => false]
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: 2 => 4
maximumPoolSize: 6 => 12
capacity: 1024 => 2048
keepAliveTime: 9999 => 9999
executeTimeOut: 800 => 3000
rejectedType: SyncPutQueuePolicy => RunsOldestTaskPolicy
allowCoreThreadTimeOut: true => true
```

另外,当 Client 集群部署时,可以修改某一个实例,或选择 `全部修改` 按钮,修改所有实例线程池信息。
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void updateWebThreadPool(ThreadPoolParameterInfo threadPoolParameterInfo)
Integer maxSize = threadPoolParameterInfo.maximumPoolSizeAdapt();
jettyExecutor.setMinThreads(coreSize);
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, maxThreads, jettyExecutor.getMaxThreads()));
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void updateWebThreadPool(ThreadPoolParameterInfo threadPoolParameterInfo)
tomcatThreadPoolExecutor.setCorePoolSize(threadPoolParameterInfo.corePoolSizeAdapt());
tomcatThreadPoolExecutor.setMaximumPoolSize(threadPoolParameterInfo.maximumPoolSizeAdapt());
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, originalMaximumPoolSize, threadPoolParameterInfo.maximumPoolSizeAdapt()),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, threadPoolParameterInfo.getKeepAliveTime()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void updateWebThreadPool(ThreadPoolParameterInfo threadPoolParameterInfo)
xnioWorker.setOption(Options.WORKER_TASK_CORE_THREADS, coreSize);
xnioWorker.setOption(Options.WORKER_TASK_MAX_THREADS, maxSize);
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, originalMaximumPoolSize, maxSize),
String.format(ChangeThreadPoolConstants.CHANGE_DELIMITER, originalKeepAliveTime, keepAliveTime));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public class ChangeThreadPoolConstants {
* Dynamic thread pool parameter change text
*/
public static final String CHANGE_THREAD_POOL_TEXT = "[{}] Dynamic thread pool change parameter." +
"\n corePoolSize: [{}]" +
"\n maximumPoolSize: [{}]" +
"\n capacity: [{}]" +
"\n keepAliveTime: [{}]" +
"\n executeTimeOut: [{}]" +
"\n rejectedType: [{}]" +
"\n allowCoreThreadTimeOut: [{}]";
"\n corePoolSize: {}" +
"\n maximumPoolSize: {}" +
"\n capacity: {}" +
"\n keepAliveTime: {}" +
"\n executeTimeOut: {}" +
"\n rejectedType: {}" +
"\n allowCoreThreadTimeOut: {}";

/**
* Dynamic thread pool parameter change separator
Expand Down

0 comments on commit 2aa6069

Please sign in to comment.