summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-10-15 12:30:59 +0200
committerMartin Polden <mpolden@mpolden.no>2021-10-15 12:58:48 +0200
commite39b8ba90b8a0a9d27e9c341a96dae7549a14bee (patch)
treee0e24b0ca908349677aacf0b80be8aabfcc96034 /controller-server
parent5f8635c0bc04821de082a08278574d5dbab4a349 (diff)
Clean up constructors
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java17
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java13
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java6
4 files changed, 18 insertions, 21 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 861d101ae3f..7b84ae7fca3 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
@@ -127,17 +127,16 @@ public class ApplicationController {
ApplicationController(Controller controller, CuratorDb curator, AccessControl accessControl, Clock clock,
FlagSource flagSource, BillingController billingController) {
-
- this.controller = controller;
- this.curator = curator;
- this.accessControl = accessControl;
+ this.controller = Objects.requireNonNull(controller);
+ this.curator = Objects.requireNonNull(curator);
+ this.accessControl = Objects.requireNonNull(accessControl);
this.configServer = controller.serviceRegistry().configServer();
- this.clock = clock;
- this.artifactRepository = controller.serviceRegistry().artifactRepository();
- this.applicationStore = controller.serviceRegistry().applicationStore();
- this.dockerImageRepoFlag = PermanentFlags.DOCKER_IMAGE_REPO.bindTo(flagSource);
- this.billingController = billingController;
+ this.clock = Objects.requireNonNull(clock);
+ this.billingController = Objects.requireNonNull(billingController);
+ artifactRepository = controller.serviceRegistry().artifactRepository();
+ applicationStore = controller.serviceRegistry().applicationStore();
+ dockerImageRepoFlag = PermanentFlags.DOCKER_IMAGE_REPO.bindTo(flagSource);
deploymentTrigger = new DeploymentTrigger(controller, clock);
applicationPackageValidator = new ApplicationPackageValidator(controller);
endpointCertificates = new EndpointCertificates(controller,
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java
index 4dd380324fa..db5260bc8c7 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Controller.java
@@ -106,29 +106,28 @@ public class Controller extends AbstractComponent {
Supplier<String> hostnameSupplier, FlagSource flagSource, MavenRepository mavenRepository,
ServiceRegistry serviceRegistry, Metric metric, SecretStore secretStore,
ControllerConfig controllerConfig, Sleeper sleeper) {
-
this.hostnameSupplier = Objects.requireNonNull(hostnameSupplier, "HostnameSupplier cannot be null");
this.curator = Objects.requireNonNull(curator, "Curator cannot be null");
this.serviceRegistry = Objects.requireNonNull(serviceRegistry, "ServiceRegistry cannot be null");
this.zoneRegistry = Objects.requireNonNull(serviceRegistry.zoneRegistry(), "ZoneRegistry cannot be null");
this.clock = Objects.requireNonNull(serviceRegistry.clock(), "Clock cannot be null");
- this.sleeper = Objects.requireNonNull(sleeper);
+ this.sleeper = Objects.requireNonNull(sleeper, "Sleeper cannot be null");
this.flagSource = Objects.requireNonNull(flagSource, "FlagSource cannot be null");
this.mavenRepository = Objects.requireNonNull(mavenRepository, "MavenRepository cannot be null");
this.metric = Objects.requireNonNull(metric, "Metric cannot be null");
+ this.controllerConfig = Objects.requireNonNull(controllerConfig, "ControllerConfig cannot be null");
+ this.secretStore = Objects.requireNonNull(secretStore, "SecretStore cannot be null");
nameServiceForwarder = new NameServiceForwarder(curator);
jobController = new JobController(this);
applicationController = new ApplicationController(this, curator, accessControl, clock, flagSource, serviceRegistry.billingController());
- tenantController = new TenantController(this, curator, accessControl, flagSource);
- routingController = new RoutingController(this, Objects.requireNonNull(rotationsConfig, "RotationsConfig cannot be null"));
+ tenantController = new TenantController(this, curator, accessControl);
+ routingController = new RoutingController(this, rotationsConfig);
auditLogger = new AuditLogger(curator, clock);
jobControl = new JobControl(new JobControlFlags(curator, flagSource));
archiveBucketDb = new CuratorArchiveBucketDb(this);
notificationsDb = new NotificationsDb(this);
- this.controllerConfig = controllerConfig;
- this.secretStore = secretStore;
- this.supportAccessControl = new SupportAccessControl(this);
+ supportAccessControl = new SupportAccessControl(this);
// Record the version of this controller
curator().writeControllerVersion(this.hostname(), ControllerVersion.CURRENT);
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
index 990549b6d8c..ef141353688 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
@@ -76,7 +76,8 @@ public class RoutingController {
public RoutingController(Controller controller, RotationsConfig rotationsConfig) {
this.controller = Objects.requireNonNull(controller, "controller must be non-null");
this.routingPolicies = new RoutingPolicies(controller);
- this.rotationRepository = new RotationRepository(rotationsConfig, controller.applications(),
+ this.rotationRepository = new RotationRepository(Objects.requireNonNull(rotationsConfig, "rotationsConfig must be non-null"),
+ controller.applications(),
controller.curator());
this.hideSharedRoutingEndpoint = Flags.HIDE_SHARED_ROUTING_ENDPOINT.bindTo(controller.flagSource());
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
index 4506362418b..537603427f5 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/TenantController.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.controller;
import com.yahoo.config.provision.TenantName;
import com.yahoo.text.Text;
import com.yahoo.vespa.curator.Lock;
-import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId;
import com.yahoo.vespa.hosted.controller.application.SystemApplication;
import com.yahoo.vespa.hosted.controller.concurrent.Once;
@@ -43,11 +42,10 @@ public class TenantController {
private final CuratorDb curator;
private final AccessControl accessControl;
- public TenantController(Controller controller, CuratorDb curator, AccessControl accessControl, FlagSource flagSource) {
+ public TenantController(Controller controller, CuratorDb curator, AccessControl accessControl) {
this.controller = Objects.requireNonNull(controller, "controller must be non-null");
this.curator = Objects.requireNonNull(curator, "curator must be non-null");
- this.accessControl = accessControl;
-
+ this.accessControl = Objects.requireNonNull(accessControl, "accessControl must be non-null");
// Update serialization format of all tenants
Once.after(Duration.ofMinutes(1), () -> {