Optimize web thread pool printing log

pull/1165/head
chen.ma 2 years ago
parent 0da5599b1d
commit 2791c41ab4

@ -17,8 +17,35 @@
package cn.hippo4j.common.enums; package cn.hippo4j.common.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Web container enum.
*/
@RequiredArgsConstructor
public enum WebContainerEnum { public enum WebContainerEnum {
TOMCAT,
JETTY, /**
UNDERTOW * Tomcat
*/
TOMCAT("Tomcat"),
/**
* Jetty
*/
JETTY("Jetty"),
/**
* Undertow
*/
UNDERTOW("Undertow");
@Getter
private final String name;
@Override
public String toString() {
return getName();
}
} }

@ -106,7 +106,7 @@ public class DynamicThreadPoolAutoConfiguration {
WebThreadPoolService webThreadPoolService, WebThreadPoolService webThreadPoolService,
Hippo4jSendMessageService hippo4jSendMessageService) { Hippo4jSendMessageService hippo4jSendMessageService) {
if (bootstrapConfigProperties.getWeb() != null && StringUtil.isBlank(bootstrapConfigProperties.getWeb().getThreadPoolId())) { if (bootstrapConfigProperties.getWeb() != null && StringUtil.isBlank(bootstrapConfigProperties.getWeb().getThreadPoolId())) {
bootstrapConfigProperties.getWeb().setThreadPoolId(webThreadPoolService.getWebContainerType().name()); bootstrapConfigProperties.getWeb().setThreadPoolId(webThreadPoolService.getWebContainerType().getName());
} }
return new WebThreadPoolConfigChangeHandler(hippo4jSendMessageService); return new WebThreadPoolConfigChangeHandler(hippo4jSendMessageService);
} }
@ -130,8 +130,8 @@ public class DynamicThreadPoolAutoConfiguration {
} }
@Bean @Bean
public AdapterExecutorsRefreshListener hippo4jAdapterExecutorsListener() { public AdapterExecutorsRefreshListener hippo4jAdapterExecutorsListener(DynamicThreadPoolAdapterRegister dynamicThreadPoolAdapterRegister) {
return new AdapterExecutorsRefreshListener(); return new AdapterExecutorsRefreshListener(dynamicThreadPoolAdapterRegister);
} }
@Bean @Bean

@ -74,7 +74,7 @@ public class ConfigModeNotifyConfigBuilder implements NotifyConfigBuilder {
return resultMap; return resultMap;
} }
if (StringUtil.isBlank(webProperties.getThreadPoolId())) { if (StringUtil.isBlank(webProperties.getThreadPoolId())) {
webProperties.setThreadPoolId(webThreadPoolService.getWebContainerType().name()); webProperties.setThreadPoolId(webThreadPoolService.getWebContainerType().getName());
} }
Map<String, List<NotifyConfigDTO>> webSingleNotifyConfigMap = Map<String, List<NotifyConfigDTO>> webSingleNotifyConfigMap =
buildSingleNotifyConfig(webProperties); buildSingleNotifyConfig(webProperties);

@ -102,7 +102,7 @@ public class WebExecutorRefreshListener extends AbstractRefreshListener<WebExecu
.nowMaximumPoolSize(now.getMaxSize()) .nowMaximumPoolSize(now.getMaxSize())
.beforeKeepAliveTime(before.getKeepAliveTime()) .beforeKeepAliveTime(before.getKeepAliveTime())
.nowKeepAliveTime(now.getKeepAliveTime()).build(); .nowKeepAliveTime(now.getKeepAliveTime()).build();
changeNotifyRequest.setThreadPoolId(webThreadPoolService.getWebContainerType().name()); changeNotifyRequest.setThreadPoolId(webThreadPoolService.getWebContainerType().getName());
return changeNotifyRequest; return changeNotifyRequest;
} }

Loading…
Cancel
Save