summaryrefslogtreecommitdiffstats
path: root/container-search/src/main
diff options
context:
space:
mode:
authorOlli Virtanen <olli.virtanen@oath.com>2019-01-03 15:11:03 +0100
committerOlli Virtanen <olli.virtanen@oath.com>2019-01-03 15:11:03 +0100
commit033182288ab6f4f404a23d1456001d31cb930fc9 (patch)
tree6d89922ce1505766261b5df7b2656f7528485f42 /container-search/src/main
parentb48a97a0814a9a5b6e42ef963f5cb9e2f61d5395 (diff)
Increased java dispatcher test coverage
Diffstat (limited to 'container-search/src/main')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4InvokerFactory.java7
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java6
2 files changed, 7 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4InvokerFactory.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4InvokerFactory.java
index 58203981039..612941ece7a 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4InvokerFactory.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FS4InvokerFactory.java
@@ -115,16 +115,13 @@ public class FS4InvokerFactory {
private SearchInvoker createCoverageErrorInvoker(List<Node> nodes, Set<Integer> failed) {
StringBuilder down = new StringBuilder("Connection failure on nodes with distribution-keys: ");
- Integer key = null;
int count = 0;
for (Node node : nodes) {
if (failed.contains(node.key())) {
- count++;
- if (key == null) {
- key = node.key();
- } else {
+ if (count > 0) {
down.append(", ");
}
+ count++;
down.append(node.key());
}
}
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
index baf401a2536..e98fc830a06 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
@@ -49,7 +49,11 @@ public class Dispatcher extends AbstractComponent {
private final boolean multilevelDispatch;
public Dispatcher(String clusterId, DispatchConfig dispatchConfig, FS4ResourcePool fs4ResourcePool, int containerClusterSize, VipStatus vipStatus) {
- this.searchCluster = new SearchCluster(clusterId, dispatchConfig, fs4ResourcePool, containerClusterSize, vipStatus);
+ this(new SearchCluster(clusterId, dispatchConfig, fs4ResourcePool, containerClusterSize, vipStatus), dispatchConfig);
+ }
+
+ public Dispatcher(SearchCluster searchCluster, DispatchConfig dispatchConfig) {
+ this.searchCluster = searchCluster;
this.loadBalancer = new LoadBalancer(searchCluster,
dispatchConfig.distributionPolicy() == DispatchConfig.DistributionPolicy.ROUNDROBIN);
this.rpcResourcePool = new RpcResourcePool(dispatchConfig);