mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-11-11 21:40:41 +00:00
Merge pull request #328 from l-vM2k/fix-mainExecutor
fix: 修复 mainExecutor 线程池在高核CPU服务器上会空指针导致应用无法启动
This commit is contained in:
@@ -54,8 +54,10 @@ public class BeanConfig {
|
||||
int processorsNum = Runtime.getRuntime().availableProcessors();
|
||||
log.info("mainExecutor,processorsNum:{}", processorsNum);
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(processorsNum * 2);
|
||||
executor.setMaxPoolSize(100);
|
||||
// 核心线程数不得超过最大线程数
|
||||
int maxPoolSize = 100;
|
||||
executor.setCorePoolSize(Math.min(processorsNum * 2, maxPoolSize));
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user