summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-06-09 16:04:06 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-06-15 13:18:01 +0200
commitcd1bfb0b2b4cabae2532b61a4ff833e5879cfbeb (patch)
treef03bfabf0c211c5112ff9a6bee87d29018017d9e
parentf23863f6f7698d4fc34392c59977447988a86754 (diff)
Scale core pool size with actual number of cores as fallback
-rw-r--r--container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
index 6fc9da298a8..a5cde6b2ee6 100644
--- a/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
+++ b/container-core/src/main/java/com/yahoo/container/handler/threadpool/ContainerThreadPool.java
@@ -83,7 +83,9 @@ public class ContainerThreadPool implements AutoCloseable {
}
private static int computeCoreThreadPoolSize(int corePoolSize, int maxNumThreads) {
- return Math.min(corePoolSize, maxNumThreads);
+ return corePoolSize <= 0
+ ? Runtime.getRuntime().availableProcessors() * 2
+ : Math.min(corePoolSize, maxNumThreads);
}
}