Browse Source

fix: 修复原子操作bean问题

main
简小朤 1 month ago
parent
commit
354fe95bad
  1. 13
      coin-framework/src/main/java/com/coin/framework/config/ThreadPoolConfig.java

13
coin-framework/src/main/java/com/coin/framework/config/ThreadPoolConfig.java

@ -56,4 +56,17 @@ public class ThreadPoolConfig {
}
};
}
@Bean(name = "atomicTaskExecutor")
public ThreadPoolTaskExecutor atomicTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(core);
executor.setMaxPoolSize(core * 2);
executor.setQueueCapacity(threadPoolProperties.getQueueCapacity());
executor.setKeepAliveSeconds(threadPoolProperties.getKeepAliveSeconds());
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.setThreadNamePrefix("atomic-task-");
executor.initialize();
return executor;
}
}

Loading…
Cancel
Save