Search in sources :

Example 1 with ServiceInstanceSet

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;
}
Also used : ServiceInstanceSet(org.apache.hadoop.hive.llap.registry.ServiceInstanceSet) ServiceInstance(org.apache.hadoop.hive.llap.registry.ServiceInstance) ByteString(com.google.protobuf.ByteString) InetAddress(java.net.InetAddress)

Aggregations

ByteString (com.google.protobuf.ByteString)1 InetAddress (java.net.InetAddress)1 ServiceInstance (org.apache.hadoop.hive.llap.registry.ServiceInstance)1 ServiceInstanceSet (org.apache.hadoop.hive.llap.registry.ServiceInstanceSet)1