Change the naming of thread pool adaptation parameters

pull/235/head
chen.ma 2 years ago
parent 1b7e1c8e97
commit fa5075a7e9

@ -36,12 +36,12 @@ public class ThreadPoolAdapterParameter {
private String threadPoolKey; private String threadPoolKey;
/** /**
* Core size * Core pool size
*/ */
private Integer coreSize; private Integer corePoolSize;
/** /**
* Maximum size * Maximum pool size
*/ */
private Integer maximumSize; private Integer maximumPoolSize;
} }

@ -77,8 +77,8 @@ public class DubboThreadPoolAdapter implements ThreadPoolAdapter, ApplicationLis
if (tp == null) { if (tp == null) {
return false; return false;
} }
tp.setCorePoolSize(threadPoolAdapterParameter.getCoreSize()); tp.setCorePoolSize(threadPoolAdapterParameter.getCorePoolSize());
tp.setMaximumPoolSize(threadPoolAdapterParameter.getMaximumSize()); tp.setMaximumPoolSize(threadPoolAdapterParameter.getMaximumPoolSize());
return true; return true;
} }

@ -87,8 +87,8 @@ public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAda
if (rocketMQConsumeExecutor != null) { if (rocketMQConsumeExecutor != null) {
int originalCoreSize = rocketMQConsumeExecutor.getCorePoolSize(); int originalCoreSize = rocketMQConsumeExecutor.getCorePoolSize();
int originalMaximumPoolSize = rocketMQConsumeExecutor.getMaximumPoolSize(); int originalMaximumPoolSize = rocketMQConsumeExecutor.getMaximumPoolSize();
rocketMQConsumeExecutor.setCorePoolSize(threadPoolAdapterParameter.getCoreSize()); rocketMQConsumeExecutor.setCorePoolSize(threadPoolAdapterParameter.getCorePoolSize());
rocketMQConsumeExecutor.setMaximumPoolSize(threadPoolAdapterParameter.getMaximumSize()); rocketMQConsumeExecutor.setMaximumPoolSize(threadPoolAdapterParameter.getMaximumPoolSize());
log.info("[{}] RocketMQ consumption thread pool parameter change. coreSize :: {}, maximumSize :: {}", log.info("[{}] RocketMQ consumption thread pool parameter change. coreSize :: {}, maximumSize :: {}",
threadPoolKey, threadPoolKey,
String.format(CHANGE_DELIMITER, originalCoreSize, rocketMQConsumeExecutor.getCorePoolSize()), String.format(CHANGE_DELIMITER, originalCoreSize, rocketMQConsumeExecutor.getCorePoolSize()),

@ -67,7 +67,7 @@ public class ThreadPoolAdapterController {
@PostMapping("/adapter/thread-pool/update") @PostMapping("/adapter/thread-pool/update")
public Result<Void> updateAdapterThreadPool(@RequestBody ThreadPoolAdapterParameter requestParameter) { public Result<Void> updateAdapterThreadPool(@RequestBody ThreadPoolAdapterParameter requestParameter) {
log.info("[{}] Change third-party thread pool data. key: {}, coreSize: {}, maximumSize: {}", log.info("[{}] Change third-party thread pool data. key: {}, coreSize: {}, maximumSize: {}",
requestParameter.getMark(), requestParameter.getThreadPoolKey(), requestParameter.getCoreSize(), requestParameter.getMaximumSize()); requestParameter.getMark(), requestParameter.getThreadPoolKey(), requestParameter.getCorePoolSize(), requestParameter.getMaximumPoolSize());
ThreadPoolAdapter threadPoolAdapter = THREAD_POOL_ADAPTER_BEAN_CONTAINER.get(requestParameter.getMark()); ThreadPoolAdapter threadPoolAdapter = THREAD_POOL_ADAPTER_BEAN_CONTAINER.get(requestParameter.getMark());
Optional.ofNullable(threadPoolAdapter).ifPresent(each -> each.updateThreadPool(requestParameter)); Optional.ofNullable(threadPoolAdapter).ifPresent(each -> each.updateThreadPool(requestParameter));
return Results.success(); return Results.success();

Loading…
Cancel
Save