public void updateServiceMap(Map<Integer, String> serviceMap) {
serviceMapRef.set(serviceMap);
}
private EndpointStrategy loadCache(CacheKey cacheKey) throws Exception {
EndpointStrategy endpointStrategy;
String service = cacheKey.getService();
if (service.contains("$HOST")) {
// Route URLs to host in the header.
endpointStrategy = discoverService(cacheKey);
if (endpointStrategy.pick() == null) {
// Now try default, this matches any host / any port in the host header.
endpointStrategy = discoverDefaultService(cacheKey);
}
} else {
endpointStrategy = discover(service);
}
if (endpointStrategy.pick() == null) {
String message = String.format("No discoverable endpoints found for service %s", cacheKey);
LOG.error(message);
throw new Exception(message);
}