summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-24 13:48:22 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-11-24 13:48:22 +0100
commit2788fa6912bbeaecb000a78797633bc22e12c678 (patch)
treeee7b2b024f8396da599b6b36196c3f2770815b9c
parent8e2abfc58e936bd6be3194f9e02a21a9b70b7692 (diff)
Prefer Java over com.google.common.collect
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java
index aa3797cb627..6c48b00d175 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.dispatch.searchcluster;
-import com.google.common.collect.ImmutableMap;
import com.yahoo.container.handler.VipStatus;
import com.yahoo.net.HostName;
import com.yahoo.prelude.Pong;
@@ -10,6 +9,7 @@ import com.yahoo.search.cluster.NodeManager;
import com.yahoo.vespa.config.search.DispatchNodesConfig;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,7 +30,7 @@ public class SearchCluster implements NodeManager<Node> {
private final VipStatus vipStatus;
private final PingFactory pingFactory;
private final SearchGroupsImpl groups;
- private long nextLogTime = 0;
+ private volatile long nextLogTime = 0;
/**
* A search node on this local machine having the entire corpus, which we therefore
@@ -96,12 +96,12 @@ public class SearchCluster implements NodeManager<Node> {
}
private static SearchGroupsImpl toGroups(Collection<Node> nodes, double minActivedocsPercentage) {
- ImmutableMap.Builder<Integer, Group> groupsBuilder = new ImmutableMap.Builder<>();
+ Map<Integer, Group> groups = new HashMap<>();
for (Map.Entry<Integer, List<Node>> group : nodes.stream().collect(Collectors.groupingBy(Node::group)).entrySet()) {
Group g = new Group(group.getKey(), group.getValue());
- groupsBuilder.put(group.getKey(), g);
+ groups.put(group.getKey(), g);
}
- return new SearchGroupsImpl(groupsBuilder.build(), minActivedocsPercentage);
+ return new SearchGroupsImpl(Map.copyOf(groups), minActivedocsPercentage);
}
public SearchGroups groupList() { return groups; }