1
zj
2024-07-18 bf47f0de2c4b4ca35ce08c7abd2b5b2477b31dac
websocketClient/src/main/java/org/example/ThreadConfig/AsyncConfiguration.java
File was renamed from websocketClient/src/main/java/org/example/config/AsyncConfiguration.java
@@ -1,4 +1,4 @@
package org.example.config;
package org.example.ThreadConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -17,11 +17,11 @@
    @Bean(name = "threadPoolTaskExecutor")
    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(50);    //  核心线程数
        executor.setMaxPoolSize(100);    //  最大线程数
        executor.setQueueCapacity(300);    //  队列容量
        executor.setCorePoolSize(400);    //  核心线程数
        executor.setMaxPoolSize(1200);    //  最大线程数
        executor.setQueueCapacity(1500);    //  队列容量
        executor.setKeepAliveSeconds(60);    //  线程空闲时的存活时间为60秒
        executor.setThreadNamePrefix("MyThread-");    //  线程名称的前缀
        executor.setThreadNamePrefix("MexcThread-");    //  线程名称的前缀
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());    //  使用  CallerRunsPolicy  拒绝策略
        return executor;
    }