diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-05 21:11:29 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-05 21:11:29 +0000 |
commit | 639ddc82c6f7769b5d23aa57df8877f9a2354741 (patch) | |
tree | 30ea7f6e6e146468aeef2f2af672c2d6259f23f6 /jrt | |
parent | 942de58890c972539d8f8842823e6924f6e1ab05 (diff) |
Limit number of connector threads to 8 and keep at least 1 on hot standby.
Diffstat (limited to 'jrt')
-rw-r--r-- | jrt/src/com/yahoo/jrt/Connector.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/jrt/src/com/yahoo/jrt/Connector.java b/jrt/src/com/yahoo/jrt/Connector.java index 98bf5124545..0fdb6cfa380 100644 --- a/jrt/src/com/yahoo/jrt/Connector.java +++ b/jrt/src/com/yahoo/jrt/Connector.java @@ -4,13 +4,16 @@ package com.yahoo.jrt; import com.yahoo.concurrent.ThreadFactoryFactory; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; class Connector { - private final ExecutorService executor = Executors.newCachedThreadPool(ThreadFactoryFactory.getDaemonThreadFactory("jrt.connector")); + private final ExecutorService executor = new ThreadPoolExecutor(1, 8, 10L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(), + ThreadFactoryFactory.getDaemonThreadFactory("jrt.connector")); private void connect(Connection conn) { conn.transportThread().addConnection(conn.connect()); |