Limit number of connector threads to 8 and keep at least 1 on hot standby.
@@ -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());
