package org.example.ThreadConfig;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
import javax.annotation.PreDestroy;
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
/**
|
* @program: dabaogp
|
* @description: 线程池配置
|
* @create: 2024-06-25 16:37
|
**/
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import javax.annotation.PreDestroy;
|
|
@Configuration
|
@EnableAsync
|
public class MarkConfiguration {
|
|
@Bean(name = "markthreadPoolTaskExecutor")
|
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
executor.setCorePoolSize(100);
|
executor.setMaxPoolSize(150);
|
executor.setQueueCapacity(200);
|
executor.setKeepAliveSeconds(30);
|
executor.setThreadNamePrefix("wsThread-");
|
executor.initialize();
|
return executor;
|
}
|
}
|