diff options
author | gjoranv <gv@verizonmedia.com> | 2020-03-16 15:34:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 15:34:31 +0100 |
commit | 94d58d03e282ef1d5afd8db8b0a451ad24806c51 (patch) | |
tree | 4f85c53d77c4e0f31b853f46b8ca5f9ec010fa5a /config-model | |
parent | 13638aa970732a9696fc9821caed4f2a1c988dee (diff) | |
parent | c3a1b3daa437a55976cd6940447e0403d92f1c69 (diff) |
Merge pull request #12579 from vespa-engine/hmusum/remove-unused-code-4
Remove unused methods
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java index eda562bea5a..3765e683b18 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java @@ -11,7 +11,6 @@ import com.yahoo.config.provision.HostSpec; import com.yahoo.config.provision.ProvisionLogger; import java.net.UnknownHostException; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -34,13 +33,11 @@ public class HostSystem extends AbstractConfigProducer<Host> { private static Logger log = Logger.getLogger(HostSystem.class.getName()); - private Map<String,String> hostnames = new LinkedHashMap<>(); - private final Map<String, HostResource> hostname2host = new LinkedHashMap<>(); private final HostProvisioner provisioner; private final DeployLogger deployLogger; - public HostSystem(AbstractConfigProducer parent, String name, HostProvisioner provisioner, DeployLogger deployLogger) { + public HostSystem(AbstractConfigProducer<?> parent, String name, HostProvisioner provisioner, DeployLogger deployLogger) { super(parent, name); this.provisioner = provisioner; this.deployLogger = deployLogger; @@ -49,7 +46,8 @@ public class HostSystem extends AbstractConfigProducer<Host> { void checkName(String hostname) { // Give a warning if the host does not exist try { - Object address = java.net.InetAddress.getByName(hostname); + @SuppressWarnings("unused") + Object ignore = java.net.InetAddress.getByName(hostname); } catch (UnknownHostException e) { deployLogger.log(Level.WARNING, "Unable to lookup IP address of host: " + hostname); } @@ -78,36 +76,10 @@ public class HostSystem extends AbstractConfigProducer<Host> { return hostname2host.get(name); } - /** - * Returns the canonical name of a given host. This will cache names for faster lookup. - * - * @param hostname the hostname to retrieve the canonical hostname for. - * @return The canonical hostname, or null if unable to resolve. - * @throws UnknownHostException if the hostname cannot be resolved - */ - public String getCanonicalHostname(String hostname) throws UnknownHostException { - if ( ! hostnames.containsKey(hostname)) { - hostnames.put(hostname, lookupCanonicalHostname(hostname)); - } - return hostnames.get(hostname); - } - - /** - * Static helper method that looks up the canonical name of a given host. - * - * @param hostname the hostname to retrieve the canonical hostname for. - * @return The canonical hostname, or null if unable to resolve. - * @throws UnknownHostException if the hostname cannot be resolved - */ - // public - This is used by amenders outside this repo - public static String lookupCanonicalHostname(String hostname) throws UnknownHostException { - return java.net.InetAddress.getByName(hostname).getCanonicalHostName(); - } - @Override public String toString() { return "hosts [" + hostname2host.values().stream() - .map(host -> host.getHostname()) + .map(HostResource::getHostname) .collect(Collectors.joining(", ")) + "]"; } @@ -169,7 +141,7 @@ public class HostSystem extends AbstractConfigProducer<Host> { } Set<HostSpec> getHostSpecs() { - return getHosts().stream().map(host -> host.spec()).collect(Collectors.toCollection(LinkedHashSet::new)); + return getHosts().stream().map(HostResource::spec).collect(Collectors.toCollection(LinkedHashSet::new)); } /** A provision logger which forwards to a deploy logger */ |