This commit is contained in:
雷欧(林平凡)
2024-11-29 11:51:08 +08:00
parent f3a9536685
commit 2a77c74ba8
7 changed files with 138 additions and 79 deletions

View File

@@ -0,0 +1,30 @@
package cn.van.business.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
/**
* @author Leo
* @version 1.0
* @create 2024/11/29 11:41
* @description
*/
@Configuration
@EnableAsync
public class AsyncConfig implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(8);
executor.setMaxPoolSize(128);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("Async-");
executor.initialize();
return executor;
}
}