线程池配置
This commit is contained in:
parent
087ef0df53
commit
528423c448
|
|
@ -70,16 +70,4 @@ public class AsyncConfig {
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置线程池 (可选,但推荐,防止大量导出任务拖垮系统)
|
|
||||||
@Bean("exportTaskExecutor")
|
|
||||||
public Executor exportTaskExecutor() {
|
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
||||||
executor.setCorePoolSize(5); // 核心线程数
|
|
||||||
executor.setMaxPoolSize(10); // 最大线程数
|
|
||||||
executor.setQueueCapacity(20); // 队列大小
|
|
||||||
executor.setThreadNamePrefix("Export-Executor-");
|
|
||||||
executor.initialize();
|
|
||||||
return executor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue