|
|
@@ -5,20 +5,13 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
-/**
|
|
|
- * 线程池配置 - 用于 NAS/OSS 批量删除等 IO 密集型任务
|
|
|
- */
|
|
|
@Configuration
|
|
|
public class ThreadPoolConfig {
|
|
|
|
|
|
- /**
|
|
|
- * IO 密集型任务线程池
|
|
|
- * 线程数 = 2 * CPU核数,适合网络上传、文件删除等阻塞操作
|
|
|
- */
|
|
|
@Bean("ioTaskExecutor")
|
|
|
public ExecutorService ioTaskExecutor() {
|
|
|
int cores = Runtime.getRuntime().availableProcessors();
|
|
|
- int poolSize = Math.max(cores , 5); // 至少 10 个线程
|
|
|
+ int poolSize = Math.max(cores , 5);
|
|
|
|
|
|
ThreadPoolExecutor executor = new ThreadPoolExecutor(
|
|
|
poolSize,
|