use of com.logicalclocks.servicediscoverclient.resolvers.DnsResolver in project hopsworks by logicalclocks.
the class ServiceDiscoveryController method getAnyAddressOfServiceWithDNSSRVOnly.
@Lock(LockType.READ)
public Service getAnyAddressOfServiceWithDNSSRVOnly(HopsworksService serviceName) throws ServiceDiscoveryException {
ServiceQuery serviceQuery = ServiceQuery.of(constructServiceFQDN(serviceName), Collections.emptySet());
DnsResolver client = (DnsResolver) getClient(Type.DNS);
Optional<Service> serviceOpt = client.getServiceSRVOnly(serviceQuery).findAny();
return serviceOpt.orElseThrow(() -> new ServiceNotFoundException("Could not find service with: " + serviceQuery));
}
Aggregations