at least 2 threads for background work

This commit is contained in:
bgamard 2020-05-07 11:09:11 +02:00
parent 7c72b5e69b
commit 0d058b9c9c

View File

@ -171,7 +171,7 @@ public class AppContext {
if (EnvironmentUtil.isUnitTest()) { if (EnvironmentUtil.isUnitTest()) {
return new EventBus(); return new EventBus();
} else { } else {
int threadCount = Runtime.getRuntime().availableProcessors() / 2; int threadCount = Math.max(Runtime.getRuntime().availableProcessors() / 2, 2);
ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount, ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount,
1L, TimeUnit.MINUTES, 1L, TimeUnit.MINUTES,
new LinkedBlockingQueue<>()); new LinkedBlockingQueue<>());