diff options
author | Olli Virtanen <olli.virtanen@oath.com> | 2019-03-12 15:44:04 +0100 |
---|---|---|
committer | Olli Virtanen <olli.virtanen@oath.com> | 2019-03-12 15:44:04 +0100 |
commit | 66ec8a5349ac6e81148ba7556ce4d056e55b7bd6 (patch) | |
tree | 9aafa6b50a54850f4b6a696b2df12a2679388faa /container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java | |
parent | 91dd5bc9eb95701aeb3110fd402257084634aa73 (diff) |
Protobuf object coversion moved to separate class. RPC classes moved to subpackage
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java b/container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java deleted file mode 100644 index e03e0875106..00000000000 --- a/container-search/src/main/java/com/yahoo/search/dispatch/RpcResourcePool.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.search.dispatch; - -import com.google.common.collect.ImmutableMap; -import com.yahoo.compress.Compressor; -import com.yahoo.processing.request.CompoundName; -import com.yahoo.vespa.config.search.DispatchConfig; - -import java.util.Map; - -/** - * RpcResourcePool constructs {@link FillInvoker} objects that communicate with content nodes over RPC. It also contains - * the RPC connection pool. - * - * @author ollivir - */ -public class RpcResourcePool { - /** The compression method which will be used with rpc dispatch. "lz4" (default) and "none" is supported. */ - public final static CompoundName dispatchCompression = new CompoundName("dispatch.compression"); - - private final Compressor compressor = new Compressor(); - private final Client client; - - /** Connections to the search nodes this talks to, indexed by node id ("partid") */ - private final ImmutableMap<Integer, Client.NodeConnection> nodeConnections; - - public RpcResourcePool(Client client, Map<Integer, Client.NodeConnection> nodeConnections) { - this.client = client; - this.nodeConnections = ImmutableMap.copyOf(nodeConnections); - } - - public RpcResourcePool(DispatchConfig dispatchConfig) { - this.client = new RpcClient(); - - // Create node rpc connections, indexed by the node distribution key - ImmutableMap.Builder<Integer, Client.NodeConnection> nodeConnectionsBuilder = new ImmutableMap.Builder<>(); - for (DispatchConfig.Node node : dispatchConfig.node()) { - nodeConnectionsBuilder.put(node.key(), client.createConnection(node.host(), node.port())); - } - this.nodeConnections = nodeConnectionsBuilder.build(); - } - - public Compressor compressor() { - return compressor; - } - - public Client client() { - return client; - } - - public ImmutableMap<Integer, Client.NodeConnection> nodeConnections() { - return nodeConnections; - } - - public void release() { - for (Client.NodeConnection nodeConnection : nodeConnections.values()) { - nodeConnection.close(); - } - } -} |