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 910ff0f3..03014af3 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 @@ -25,12 +25,16 @@ import cn.hippo4j.common.model.ThreadPoolRunStateInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; + import java.util.concurrent.Executor; /** * Abstract web thread pool service. */ @Slf4j +@Order(Ordered.HIGHEST_PRECEDENCE) public abstract class AbstractWebThreadPoolService implements WebThreadPoolService, ApplicationRunner { private final IWebThreadPoolHandlerSupport support; diff --git a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/DefaultAbstractWebThreadPoolService.java b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/DefaultAbstractWebThreadPoolService.java index ebb98f0e..e519c5b6 100644 --- a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/DefaultAbstractWebThreadPoolService.java +++ b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/DefaultAbstractWebThreadPoolService.java @@ -18,22 +18,28 @@ package cn.hippo4j.adapter.web; import cn.hippo4j.common.config.ApplicationContextHolder; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.web.context.WebServerApplicationContext; import org.springframework.boot.web.server.WebServer; import org.springframework.context.ApplicationContext; +import org.springframework.util.ReflectionUtils; +import java.lang.reflect.Field; import java.util.concurrent.Executor; /** * Default WebThreadPoolService abstract class, * reuses common capabilities for web container operations. */ +@Slf4j public abstract class DefaultAbstractWebThreadPoolService extends AbstractWebThreadPoolService { public DefaultAbstractWebThreadPoolService(IWebThreadPoolHandlerSupport support) { super(support); } + private static final String STARTED_FIELD_NAME = "started"; + /** * Get the internal abstract method of the web container thread pool, * to be implemented by subclasses. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/AbstractWebThreadPoolService1x.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/AbstractWebThreadPoolService1x.java index 333a4d07..148a5deb 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/AbstractWebThreadPoolService1x.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-1x-starter/src/main/java/cn/hippo4j/config/springboot1x/starter/web/AbstractWebThreadPoolService1x.java @@ -20,18 +20,25 @@ package cn.hippo4j.config.springboot1x.starter.web; import cn.hippo4j.adapter.web.AbstractWebThreadPoolService; import cn.hippo4j.adapter.web.IWebThreadPoolHandlerSupport; import cn.hippo4j.common.config.ApplicationContextHolder; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; +import org.springframework.util.ReflectionUtils; + +import java.lang.reflect.Field; /** * Abstract class for adapting WebThreadPoolService to Spring 1.x version. */ +@Slf4j public abstract class AbstractWebThreadPoolService1x extends AbstractWebThreadPoolService { public AbstractWebThreadPoolService1x(IWebThreadPoolHandlerSupport support) { super(support); } + private static final String STARTED_FIELD_NAME = "started"; + /** * Get the embedded Servlet container from the Spring application context. */ @@ -46,4 +53,5 @@ public abstract class AbstractWebThreadPoolService1x extends AbstractWebThreadPo public Integer getPort() { return getContainer().getPort(); } + }