aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-apps/src/main/java/com
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-02-08 22:53:19 +0100
committerHarald Musum <musum@verizonmedia.com>2021-02-08 22:53:19 +0100
commited4492de5dcb7150a2ba33d70ad7ce02ceec0fb0 (patch)
treeeced089e19fb081ae22df105088fab5c65be615d /clustercontroller-apps/src/main/java/com
parent414568759416e98f41b248660b78465e67c8268a (diff)
Cleanup: Remove unnecessary and unused methods, simplify
Diffstat (limited to 'clustercontroller-apps/src/main/java/com')
-rw-r--r--clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java
index 9f439cbd992..df778028325 100644
--- a/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java
+++ b/clustercontroller-apps/src/main/java/com/yahoo/vespa/clustercontroller/apps/clustercontroller/ClusterControllerClusterConfigurer.java
@@ -1,4 +1,4 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.apps.clustercontroller;
import com.yahoo.jdisc.Metric;
@@ -19,31 +19,36 @@ import java.util.Map;
*/
public class ClusterControllerClusterConfigurer {
- private final FleetControllerOptions options = new FleetControllerOptions(null);
+ private final FleetControllerOptions options;
public ClusterControllerClusterConfigurer(ClusterController controller,
StorDistributionConfig distributionConfig,
FleetcontrollerConfig fleetcontrollerConfig,
SlobroksConfig slobroksConfig,
ZookeepersConfig zookeepersConfig,
- Metric metricImpl) throws Exception
- {
- configure(distributionConfig);
- configure(fleetcontrollerConfig);
- configure(slobroksConfig);
- configure(zookeepersConfig);
+ Metric metricImpl) throws Exception {
+ this.options = configure(distributionConfig, fleetcontrollerConfig, slobroksConfig, zookeepersConfig);
if (controller != null) {
controller.setOptions(options, metricImpl);
}
}
- public FleetControllerOptions getOptions() { return options; }
+ FleetControllerOptions getOptions() { return options; }
- private void configure(StorDistributionConfig config) {
- options.setStorageDistribution(new Distribution(config));
+ private static FleetControllerOptions configure(StorDistributionConfig distributionConfig,
+ FleetcontrollerConfig fleetcontrollerConfig,
+ SlobroksConfig slobroksConfig,
+ ZookeepersConfig zookeepersConfig) {
+ Distribution distribution = new Distribution(distributionConfig);
+ FleetControllerOptions options = new FleetControllerOptions(fleetcontrollerConfig.cluster_name(), distribution.getNodes());
+ options.setStorageDistribution(distribution);
+ configure(options, fleetcontrollerConfig);
+ configure(options, slobroksConfig);
+ configure(options, zookeepersConfig);
+ return options;
}
- private void configure(FleetcontrollerConfig config) {
+ private static void configure(FleetControllerOptions options, FleetcontrollerConfig config) {
options.clusterName = config.cluster_name();
options.fleetControllerIndex = config.index();
options.fleetControllerCount = config.fleet_controller_count();
@@ -80,7 +85,7 @@ public class ClusterControllerClusterConfigurer {
options.clusterFeedBlockLimit = Map.copyOf(config.cluster_feed_block_limit());
}
- private void configure(SlobroksConfig config) {
+ private static void configure(FleetControllerOptions options, SlobroksConfig config) {
String[] specs = new String[config.slobrok().size()];
for (int i = 0; i < config.slobrok().size(); i++) {
specs[i] = config.slobrok().get(i).connectionspec();
@@ -88,11 +93,11 @@ public class ClusterControllerClusterConfigurer {
options.slobrokConnectionSpecs = specs;
}
- private void configure(ZookeepersConfig config) {
+ private static void configure(FleetControllerOptions options, ZookeepersConfig config) {
options.zooKeeperServerAddress = verifyZooKeeperAddress(config.zookeeperserverlist());
}
- private String verifyZooKeeperAddress(String zooKeeperServerAddress) {
+ private static String verifyZooKeeperAddress(String zooKeeperServerAddress) {
if (zooKeeperServerAddress == null || "".equals(zooKeeperServerAddress)) {
throw new IllegalArgumentException("zookeeper server address must be set, was '" + zooKeeperServerAddress + "'");
}