diff --git a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/AbstractWebThreadPoolService.java b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/AbstractWebThreadPoolService.java index 7260fc25..910ff0f3 100644 --- a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/AbstractWebThreadPoolService.java +++ b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/AbstractWebThreadPoolService.java @@ -17,7 +17,6 @@ package cn.hippo4j.adapter.web; -import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.enums.WebContainerEnum; import cn.hippo4j.common.model.ThreadPoolBaseInfo; import cn.hippo4j.common.model.ThreadPoolParameter; @@ -26,14 +25,7 @@ import cn.hippo4j.common.model.ThreadPoolRunStateInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; -import org.springframework.boot.web.context.WebServerApplicationContext; -import org.springframework.boot.web.server.WebServer; -import org.springframework.context.ApplicationContext; - -import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; /** * Abstract web thread pool service. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/jetty/JettyWebThreadPoolHandler1x.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/jetty/JettyWebThreadPoolHandler1x.java index edaba7c1..be7bac20 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/jetty/JettyWebThreadPoolHandler1x.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/jetty/JettyWebThreadPoolHandler1x.java @@ -26,6 +26,7 @@ import cn.hippo4j.common.model.ThreadPoolParameterInfo; import cn.hippo4j.common.model.ThreadPoolRunStateInfo; import cn.hippo4j.common.web.exception.ServiceException; import cn.hippo4j.config.springboot1x.starter.web.AbstractWebThreadPoolService1x; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer; import java.util.concurrent.Executor; @@ -33,6 +34,7 @@ import java.util.concurrent.Executor; /** * WebThreadPoolHandler compatible with Jetty container for Spring 1.x version. */ +@Slf4j public class JettyWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x { public JettyWebThreadPoolHandler1x() { @@ -44,7 +46,8 @@ public class JettyWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x try { return ((JettyEmbeddedServletContainer) getContainer()).getServer().getThreadPool(); } catch (Throwable th) { - throw new ServiceException("Failed to get Jetty thread pool.", th); + log.error("Failed to get Jetty thread pool.", th); + return null; } } diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/tomcat/TomcatWebThreadPoolHandler1x.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/tomcat/TomcatWebThreadPoolHandler1x.java index 30655937..614c8ecf 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/tomcat/TomcatWebThreadPoolHandler1x.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/tomcat/TomcatWebThreadPoolHandler1x.java @@ -48,7 +48,8 @@ public class TomcatWebThreadPoolHandler1x extends AbstractWebThreadPoolService1x return ((TomcatEmbeddedServletContainer) getContainer()) .getTomcat().getConnector().getProtocolHandler().getExecutor(); } catch (Throwable th) { - throw new ServiceException("Failed to get Tomcat thread pool.", th); + log.error("Failed to get Tomcat thread pool.", th); + return null; } } diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/undertow/UndertowWebThreadPoolHandler1x.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/undertow/UndertowWebThreadPoolHandler1x.java index 88bc9578..c44a8e95 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/undertow/UndertowWebThreadPoolHandler1x.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/undertow/UndertowWebThreadPoolHandler1x.java @@ -55,7 +55,8 @@ public class UndertowWebThreadPoolHandler1x extends AbstractWebThreadPoolService Undertow undertow = (Undertow) ReflectionUtils.getField(field, container); return undertow.getWorker(); } catch (Throwable th) { - throw new ServiceException("Failed to get Undertow thread pool.", th); + log.error("Failed to get Undertow thread pool.", th); + return null; } }