diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java index 90f36547..5efda119 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java @@ -22,11 +22,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.context.annotation.Bean; + /** * Dynamic thread pool. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) +@Bean public @interface DynamicThreadPool { } diff --git a/hippo4j-example/hippo4j-config-etcd-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/etcd/config/ThreadPoolConfig.java b/hippo4j-example/hippo4j-config-etcd-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/etcd/config/ThreadPoolConfig.java index 71e6d943..524620a3 100644 --- a/hippo4j-example/hippo4j-config-etcd-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/etcd/config/ThreadPoolConfig.java +++ b/hippo4j-example/hippo4j-config-etcd-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/etcd/config/ThreadPoolConfig.java @@ -32,7 +32,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Configuration public class ThreadPoolConfig { - @Bean @DynamicThreadPool public ThreadPoolExecutor messageConsumeDynamicExecutor() { String threadPoolId = "message-consume"; diff --git a/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/config/DynamicThreadPoolConfig.java b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/config/DynamicThreadPoolConfig.java index c581863a..a99bac81 100644 --- a/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/config/DynamicThreadPoolConfig.java +++ b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/config/DynamicThreadPoolConfig.java @@ -17,19 +17,19 @@ package cn.hippo4j.example.core.config; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; + import cn.hippo4j.core.executor.DynamicThreadPool; import cn.hippo4j.core.executor.support.ThreadPoolBuilder; import cn.hippo4j.example.core.handler.TaskTraceBuilderHandler; import cn.hippo4j.example.core.inittest.TaskDecoratorTest; import com.alibaba.ttl.threadpool.TtlExecutors; import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; + import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; - import static cn.hippo4j.common.constant.Constants.AVAILABLE_PROCESSORS; import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_CONSUME; import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_PRODUCE; @@ -41,7 +41,6 @@ import static cn.hippo4j.example.core.constant.GlobalTestConstant.MESSAGE_PRODUC @Configuration public class DynamicThreadPoolConfig { - @Bean @DynamicThreadPool public Executor messageConsumeTtlDynamicThreadPool() { String threadPoolId = MESSAGE_CONSUME; @@ -59,7 +58,6 @@ public class DynamicThreadPoolConfig { return ttlExecutor; } - @Bean @DynamicThreadPool public ThreadPoolExecutor messageProduceDynamicThreadPool() { String threadPoolId = MESSAGE_PRODUCE;