aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
index c56a5f0bd66..7f4a707949b 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
@@ -74,11 +74,12 @@ public class RoutingPolicy {
Optional<Endpoint> infraEndpoint = SystemApplication.matching(id.owner())
.flatMap(app -> app.endpointIn(id.zone(), zoneRegistry));
if (infraEndpoint.isPresent()) return infraEndpoint.get();
- return Endpoint.of(id.owner())
- .target(id.cluster(), id.zone())
- .on(Port.fromRoutingMethod(routingMethod))
- .routingMethod(routingMethod)
- .in(system);
+ return endpoint(routingMethod).in(system);
+ }
+
+ /** Returns the weighted endpoint of this */
+ public Endpoint weightedEndpointIn(SystemName system, RoutingMethod routingMethod) {
+ return endpoint(routingMethod).weighted().in(system);
}
@Override
@@ -101,4 +102,11 @@ public class RoutingPolicy {
id.zone().value());
}
+ private Endpoint.EndpointBuilder endpoint(RoutingMethod routingMethod) {
+ return Endpoint.of(id.owner())
+ .target(id.cluster(), id.zone())
+ .on(Port.fromRoutingMethod(routingMethod))
+ .routingMethod(routingMethod);
+ }
+
}