Refine Executor Service config.

Require at least a concurrency of 4.
This commit is contained in:
Mark Paluch
2024-10-18 13:19:54 +02:00
parent b4c85d2cca
commit c4853b8615

View File

@@ -43,8 +43,8 @@ class ExecutorConfiguration {
public ThreadPoolExecutorFactoryBean threadPoolExecutorFactoryBean() {
int processors = Runtime.getRuntime().availableProcessors();
int threadCount = Math.max(2, processors - 4);
log.info(String.format("Setting up Executor Service with %d Threads", threadCount));
int threadCount = Math.max(4, processors - 4);
log.info(String.format("Setting up Executor Service with %d Threads, %d processors", threadCount, processors));
ThreadPoolExecutorFactoryBean scheduler = new ThreadPoolExecutorFactoryBean();
scheduler.setCorePoolSize(threadCount);