
org.openshift.ping.dns.GetServiceHosts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openshift-ping-dns Show documentation
Show all versions of openshift-ping-dns Show documentation
Openshift PING - DNS (openshift.DNS_PING)
package org.openshift.ping.dns;
import java.net.InetAddress;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.concurrent.Callable;
public class GetServiceHosts implements Callable> {
private final String _serviceName;
public GetServiceHosts(String serviceName) {
_serviceName = serviceName;
}
@Override
public Set call() throws Exception {
Set serviceHosts = null;
InetAddress[] inetAddresses = InetAddress.getAllByName(_serviceName);
for (InetAddress inetAddress : inetAddresses) {
if (serviceHosts == null) {
serviceHosts = new LinkedHashSet();
}
serviceHosts.add(inetAddress.getHostAddress());
}
return serviceHosts;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy