summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/dispatch/rpc
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-23 11:35:03 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-11-23 11:36:28 +0100
commit0a3d6beec5b28150694297a99716ea23732dc6c5 (patch)
tree5437b4e56ef6fe10084b99fe22966cd7a9d9deab /container-search/src/main/java/com/yahoo/search/dispatch/rpc
parentef637d4a7236d6570c748ba5782e0435f628bd9a (diff)
Put the RpcClient back in the RpcResourcePool where it belongs.
Remove parts of schema test no longer valid.
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/rpc')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcResourcePool.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcResourcePool.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcResourcePool.java
index 71e8cc0baa8..db95921c47b 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcResourcePool.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcResourcePool.java
@@ -4,6 +4,7 @@ package com.yahoo.search.dispatch.rpc;
import com.google.common.collect.ImmutableMap;
import com.yahoo.search.dispatch.FillInvoker;
import com.yahoo.search.dispatch.rpc.Client.NodeConnection;
+import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.config.search.DispatchNodesConfig;
import java.util.ArrayList;
@@ -22,22 +23,26 @@ public class RpcResourcePool implements RpcConnectionPool, AutoCloseable {
/** Connections to the search nodes this talks to, indexed by node id ("partid") */
private final ImmutableMap<Integer, NodeConnectionPool> nodeConnectionPools;
+ private final RpcClient rpcClient;
RpcResourcePool(Map<Integer, NodeConnection> nodeConnections) {
var builder = new ImmutableMap.Builder<Integer, NodeConnectionPool>();
nodeConnections.forEach((key, connection) -> builder.put(key, new NodeConnectionPool(Collections.singletonList(connection))));
this.nodeConnectionPools = builder.build();
+ this.rpcClient = null;
}
- public RpcResourcePool(RpcClient client, DispatchNodesConfig nodesConfig, int numConnections) {
+ public RpcResourcePool(DispatchConfig dispatchConfig, DispatchNodesConfig nodesConfig) {
super();
+ rpcClient = new RpcClient("dispatch-client", dispatchConfig.numJrtTransportThreads());
// Create rpc node connection pools indexed by the node distribution key
+ int numConnections = dispatchConfig.numJrtConnectionsPerNode();
var builder = new ImmutableMap.Builder<Integer, NodeConnectionPool>();
for (var node : nodesConfig.node()) {
var connections = new ArrayList<NodeConnection>(numConnections);
for (int i = 0; i < numConnections; i++) {
- connections.add(client.createConnection(node.host(), node.port()));
+ connections.add(rpcClient.createConnection(node.host(), node.port()));
}
builder.put(node.key(), new NodeConnectionPool(connections));
}
@@ -57,6 +62,9 @@ public class RpcResourcePool implements RpcConnectionPool, AutoCloseable {
@Override
public void close() {
nodeConnectionPools.values().forEach(NodeConnectionPool::release);
+ if (rpcClient != null) {
+ rpcClient.close();
+ }
}
private static class NodeConnectionPool {