Suggestion
- org.springframework.scheduling.annotation.Async enhancement
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Async {
String value() default "";
/**
* limit and control the concurrent thread num to avoid OOM , outer-interface QPS limited and so on
*
* if null , use global threadpool
* if not null,create a threadpool , when method or class is invoked ,use the current threadpool
*/
Integer threadNum() default null;
}
i will not need to definite threadpools for each scene ,just only definite @Async on the method
consider it ?
Comment From: snicoll
Thanks for the suggestion but configuring the threadpool is already supported, please see AsyncConfigurer
and the reference documentation.
Comment From: szd1993
你好,来信已收到,我会尽快查看。-----------------------------------------------
Comment From: szd1993
@snicoll but AsyncConfigurer is global ,i want each method have a pool
Comment From: snicoll
each @Async
method can refer to a TaskExecutor
bean, see https://docs.spring.io/spring-framework/docs/current/reference/html/integration.html#scheduling-annotation-support-qualification