Skip to content

Commit

Permalink
Fix SpringDynamicThreadPool does not take effect
Browse files Browse the repository at this point in the history
  • Loading branch information
magestacks committed Oct 7, 2022
1 parent 508e894 commit 76f1651
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,8 +26,8 @@
/**
* Dynamic thread pool.
*/
@Target(ElementType.METHOD)
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DynamicThreadPool {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,8 +60,10 @@ public Executor messageConsumeTtlDynamicThreadPool() {
return ttlExecutor;
}

@Bean
@DynamicThreadPool
/**
* {@link Bean @Bean} and {@link DynamicThreadPool @DynamicThreadPool}.
*/
@SpringDynamicThreadPool
public ThreadPoolExecutor messageProduceDynamicThreadPool() {
return ThreadPoolBuilder.builderDynamicPoolById(MESSAGE_PRODUCE);
}
Expand Down

0 comments on commit 76f1651

Please sign in to comment.