diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-09-28 22:12:07 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-09-28 22:12:07 +0200 |
commit | 0f6556f7c9124b9fc80831b5f1d5111b5f94ffbb (patch) | |
tree | 3d8a765e4bf5abc5b42ba80325f204d7efa81284 /controller-server | |
parent | c207d65cbb79e894d049eb80a27fe6f8f28b04fa (diff) |
Make instance iteration order stable, and fix javadoc
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java | 8 | ||||
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java index 10ce3b93614..83fb71422cb 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java @@ -1,6 +1,7 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller; +import com.google.common.collect.ImmutableMap; import com.yahoo.component.Version; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.ValidationOverrides; @@ -79,8 +80,11 @@ public class Application { this.pemDeployKey = Objects.requireNonNull(pemDeployKey, "pemDeployKey cannot be null"); this.projectId = Objects.requireNonNull(projectId, "projectId cannot be null"); this.internal = internal; - this.instances = instances.stream().collect(Collectors.toUnmodifiableMap(instance -> instance.id().instance(), - instance -> instance)); + this.instances = ImmutableMap.copyOf((Iterable<Map.Entry<InstanceName, Instance>>) + instances.stream() + .map(instance -> Map.entry(instance.name(), instance)) + .sorted(Comparator.comparing(Map.Entry::getKey)) + ::iterator); } /** Returns an aggregate application, from the given instances, if at least one. */ diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java index cc601ca8edf..c9ec355a3b9 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java @@ -26,6 +26,7 @@ import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics; import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.application.EndpointList; import com.yahoo.vespa.hosted.controller.application.JobStatus; +import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; import com.yahoo.vespa.hosted.controller.metric.ApplicationMetrics; import com.yahoo.vespa.hosted.controller.rotation.RotationStatus; @@ -299,7 +300,7 @@ public class Instance { /** * Returns the oldest platform version this has deployed in a permanent zone (not test or staging). * - * This is unfortunately quite similar to {@link ApplicationController#oldestInstalledPlatform(ApplicationId)}, + * This is unfortunately quite similar to {@link ApplicationController#oldestInstalledPlatform(TenantAndApplicationId)}, * but this checks only what the controller has deployed to the production zones, while that checks the node repository * to see what's actually installed on each node. Thus, this is the right choice for, e.g., target Vespa versions for * new deployments, while that is the right choice for version to compile against. |