Web Pool 相关代码格式调整.

pull/121/head
chen.ma 3 years ago
parent ab9d605c08
commit 249fadab9a

@ -152,7 +152,8 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@ConditionalOnBean(name = JETTY_SERVLET_WEB_SERVER_FACTORY)
public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {return new JettyWebThreadPoolHandler();
public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {
return new JettyWebThreadPoolHandler();
}
@Bean
@ -161,7 +162,6 @@ public class DynamicThreadPoolAutoConfiguration {
return new UndertowWebThreadPoolHandler();
}
@Bean
public WebThreadPoolHandlerChoose webThreadPoolServiceChoose() {
return new WebThreadPoolHandlerChoose();

@ -44,5 +44,4 @@ public abstract class AbstractWebThreadPoolService implements WebThreadPoolServi
return executor;
}
}

@ -14,9 +14,7 @@ import java.util.concurrent.Executor;
* @description:
*/
@Slf4j
public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{
public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService {
@Override
protected Executor getWebThreadPoolByServer(WebServer webServer) {
@ -33,6 +31,7 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{
Integer maxSize = poolParameterInfo.getMaxSize();
jettyExecutor.setMinThreads(coreSize);
jettyExecutor.setMaxThreads(maxSize);
log.info(
"🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}]",
String.format("%s => %s", jettyExecutor.getMinThreads(), coreSize),
@ -41,8 +40,6 @@ public class JettyWebThreadPoolHandler extends AbstractWebThreadPoolService{
} catch (Exception ex) {
log.error("Failed to modify the jetty thread pool parameter.", ex);
}
}
}

@ -19,8 +19,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/
@Slf4j
@AllArgsConstructor
public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService{
public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
private final AtomicBoolean cacheFlag = new AtomicBoolean(Boolean.FALSE);
@ -52,17 +51,17 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService{
tomcatExecutor.setCorePoolSize(poolParameterInfo.getCoreSize());
tomcatExecutor.setMaximumPoolSize(poolParameterInfo.getMaxSize());
tomcatExecutor.setKeepAliveTime(poolParameterInfo.getKeepAliveTime(), TimeUnit.SECONDS);
int originalCoreSize = tomcatExecutor.getCorePoolSize();
int originalMaximumPoolSize = tomcatExecutor.getMaximumPoolSize();
long originalKeepAliveTime = tomcatExecutor.getKeepAliveTime(TimeUnit.SECONDS);
log.info(
"🔥 Changed web thread pool. coreSize :: [{}], maxSize :: [{}], keepAliveTime :: [{}]",
String.format("%s => %s", originalCoreSize, poolParameterInfo.getCoreSize()),
String.format("%s => %s", originalMaximumPoolSize, poolParameterInfo.getMaxSize()),
String.format("%s => %s", originalKeepAliveTime, poolParameterInfo.getKeepAliveTime())
);
} catch (Exception ex) {
log.error("Failed to modify the Tomcat thread pool parameter.", ex);
}

@ -60,7 +60,6 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService {
} catch (Exception ex) {
log.error("Failed to modify the undertow thread pool parameter.", ex);
}
}
}

Loading…
Cancel
Save