Fix SpringDynamicThreadPool does not take effect

pull/764/head
chen.ma 2 years ago
parent 508e894758
commit 76f1651f58

@ -17,6 +17,7 @@
package cn.hippo4j.core.executor;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -25,8 +26,8 @@ import java.lang.annotation.Target;
/**
* Dynamic thread pool.
*/
@Target(ElementType.METHOD)
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DynamicThreadPool {
}

@ -17,20 +17,24 @@
package cn.hippo4j.core.executor;
import org.springframework.context.annotation.Bean;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Bean;
/**
*@author : wh
*@date : 2022/10/2 16:10
*@description:
* A convenience annotation that is itself annotated with
* {@link Bean @Bean} and {@link DynamicThreadPool @DynamicThreadPool}.
*
* @since 1.4.2
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Bean
@DynamicThreadPool
public @interface SpringDynamicThreadPool {
}

@ -18,6 +18,7 @@
package cn.hippo4j.example.core.config;
import cn.hippo4j.core.executor.DynamicThreadPool;
import cn.hippo4j.core.executor.SpringDynamicThreadPool;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
import cn.hippo4j.example.core.handler.TaskTraceBuilderHandler;
import cn.hippo4j.example.core.inittest.TaskDecoratorTest;
@ -59,8 +60,10 @@ public class DynamicThreadPoolConfig {
return ttlExecutor;
}
@Bean
@DynamicThreadPool
/**
* {@link Bean @Bean} and {@link DynamicThreadPool @DynamicThreadPool}.
*/
@SpringDynamicThreadPool
public ThreadPoolExecutor messageProduceDynamicThreadPool() {
return ThreadPoolBuilder.builderDynamicPoolById(MESSAGE_PRODUCE);
}

Loading…
Cancel
Save