diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-06-14 13:00:48 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-06-14 13:56:53 +0200 |
commit | 88ef55cb45e9998df62bf8f76b0244861b6f4e9a (patch) | |
tree | d34d893b73823dea1c73a5e84b46ad99d9df8315 /controller-server | |
parent | bd2cd6f6e6f9b9c6f0a82907a9bd4e0c6f62ee68 (diff) |
Expect exceptions from RoutingGenerator when looking for endpoints
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index 9edff876fb4..7e2b04c5a79 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -548,19 +548,19 @@ public class ApplicationController { .orElse(id.applicationId().instance().isTester())) throw new NotExistsException("Deployment", id.toString()); + // TODO jvenstad: Swap to use routingPolicies first, when this is ready. try { - return Optional.of(routingGenerator.clusterEndpoints(id)) - .filter(endpoints -> ! endpoints.isEmpty()) - .orElseGet(() -> routingPolicies.get(id).stream() - .filter(policy -> policy.endpointIn(controller.system()).scope() == Endpoint.Scope.zone) - .collect(Collectors.toUnmodifiableMap(policy -> policy.cluster(), - policy -> policy.endpointIn(controller.system()).url()))); + var endpoints = routingGenerator.clusterEndpoints(id); + if ( ! endpoints.isEmpty()) + return endpoints; } catch (RuntimeException e) { - log.log(Level.WARNING, "Failed to get endpoint information for " + id + ": " - + Exceptions.toMessageString(e)); - return Collections.emptyMap(); + log.log(Level.WARNING, "Failed to get endpoint information for " + id + ": " + Exceptions.toMessageString(e)); } + return routingPolicies.get(id).stream() + .filter(policy -> policy.endpointIn(controller.system()).scope() == Endpoint.Scope.zone) + .collect(Collectors.toUnmodifiableMap(policy -> policy.cluster(), + policy -> policy.endpointIn(controller.system()).url())); } /** Returns all zone-specific cluster endpoints for the given application, in the given zones. */ |