diff options
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java index a4557c2ea9c..576b009c846 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileDistributor.java @@ -68,12 +68,7 @@ public class FileDistributor { } private Set<Host> getHosts(FileReference reference) { - Set<Host> hosts = filesToHosts.get(reference); - if (hosts == null) { - hosts = new HashSet<>(); - filesToHosts.put(reference, hosts); - } - return hosts; + return filesToHosts.computeIfAbsent(reference, k -> new HashSet<>()); } public FileDistributor(FileRegistry fileRegistry, List<ConfigServerSpec> configServerSpecs) { @@ -106,7 +101,7 @@ public class FileDistributor { } public Set<FileReference> allFilesToSend() { - return filesToHosts.keySet(); + return Set.copyOf(filesToHosts.keySet()); } // should only be called during deploy |