use of org.apache.hadoop.hive.llap.registry.ServiceInstanceSet in project hive by apache.
the class LlapBaseInputFormat method getServiceInstanceForHost.
private ServiceInstance getServiceInstanceForHost(LlapRegistryService registryService, String host) throws IOException {
InetAddress address = InetAddress.getByName(host);
ServiceInstanceSet instanceSet = registryService.getInstances();
ServiceInstance serviceInstance = null;
// The name used in the service registry may not match the host name we're using.
// Try hostname/canonical hostname/host address
String name = address.getHostName();
LOG.info("Searching service instance by hostname " + name);
serviceInstance = selectServiceInstance(instanceSet.getByHost(name));
if (serviceInstance != null) {
return serviceInstance;
}
name = address.getCanonicalHostName();
LOG.info("Searching service instance by canonical hostname " + name);
serviceInstance = selectServiceInstance(instanceSet.getByHost(name));
if (serviceInstance != null) {
return serviceInstance;
}
name = address.getHostAddress();
LOG.info("Searching service instance by address " + name);
serviceInstance = selectServiceInstance(instanceSet.getByHost(name));
if (serviceInstance != null) {
return serviceInstance;
}
return serviceInstance;
}
Aggregations