use of com.logicalclocks.servicediscoverclient.Builder in project hopsworks by logicalclocks.
the class Settings method getAlertManagerService.
private static Optional<Service> getAlertManagerService(String serviceFQDN) throws ServiceDiscoveryException {
ServiceDiscoveryClient client = null;
Optional<Service> services;
try {
client = new Builder(Type.DNS).build();
String name = Strings.isNullOrEmpty(serviceFQDN) ? DEFAULT_ALERTMANAGER_FQDN : serviceFQDN;
services = client.getService(ServiceQuery.of(name, Collections.emptySet())).findFirst();
} finally {
if (client != null) {
client.close();
}
}
return services;
}
Aggregations