From 0d058b9c9cb13d96594cba3e38ab7b0adcf7f39a Mon Sep 17 00:00:00 2001 From: bgamard Date: Thu, 7 May 2020 11:09:11 +0200 Subject: [PATCH] at least 2 threads for background work --- .../java/com/sismics/docs/core/model/context/AppContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-core/src/main/java/com/sismics/docs/core/model/context/AppContext.java b/docs-core/src/main/java/com/sismics/docs/core/model/context/AppContext.java index 71a168a4..f60dc575 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/model/context/AppContext.java +++ b/docs-core/src/main/java/com/sismics/docs/core/model/context/AppContext.java @@ -171,7 +171,7 @@ public class AppContext { if (EnvironmentUtil.isUnitTest()) { return new EventBus(); } else { - int threadCount = Runtime.getRuntime().availableProcessors() / 2; + int threadCount = Math.max(Runtime.getRuntime().availableProcessors() / 2, 2); ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>());