diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-06-29 18:13:15 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2017-07-04 23:47:46 +0200 |
commit | 5694a472f1f507f80c7aad3edee93df95a23a4c2 (patch) | |
tree | d8ba063d3bc7d3f65f65dc737287cf5b980d2879 /server/sonar-ce/src/main/java | |
parent | 4ad21e8bc6085cb13d16e5b7e68b475296833bd2 (diff) | |
download | sonarqube-5694a472f1f507f80c7aad3edee93df95a23a4c2.tar.gz sonarqube-5694a472f1f507f80c7aad3edee93df95a23a4c2.zip |
SONAR-9478 Replace Settings by Configuration
Diffstat (limited to 'server/sonar-ce/src/main/java')
-rw-r--r-- | server/sonar-ce/src/main/java/org/sonar/ce/cluster/HazelcastClientWrapperImpl.java | 12 | ||||
-rw-r--r-- | server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/cluster/HazelcastClientWrapperImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/cluster/HazelcastClientWrapperImpl.java index 13c383ba329..b913387c84a 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/cluster/HazelcastClientWrapperImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/cluster/HazelcastClientWrapperImpl.java @@ -29,7 +29,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.locks.Lock; import org.picocontainer.Startable; -import org.sonar.api.config.Settings; +import org.sonar.api.config.Configuration; import org.sonar.process.ProcessProperties; import static com.google.common.base.Preconditions.checkState; @@ -46,10 +46,10 @@ public class HazelcastClientWrapperImpl implements Startable, HazelcastClientWra @VisibleForTesting protected HazelcastInstance hzInstance; - public HazelcastClientWrapperImpl(Settings settings) { - boolean clusterEnabled = settings.getBoolean(ProcessProperties.CLUSTER_ENABLED); - String clusterName = settings.getString(ProcessProperties.CLUSTER_NAME); - String clusterLocalEndPoint = settings.getString(ProcessProperties.CLUSTER_LOCALENDPOINT); + public HazelcastClientWrapperImpl(Configuration config) { + boolean clusterEnabled = config.getBoolean(ProcessProperties.CLUSTER_ENABLED).orElse(false); + String clusterName = config.get(ProcessProperties.CLUSTER_NAME).orElse(null); + String clusterLocalEndPoint = config.get(ProcessProperties.CLUSTER_LOCALENDPOINT).orElse(null); checkState(clusterEnabled, "Cluster is not enabled"); checkState(isNotEmpty(clusterLocalEndPoint), "LocalEndPoint have not been set"); @@ -85,7 +85,7 @@ public class HazelcastClientWrapperImpl implements Startable, HazelcastClientWra } @Override - public <K,V> Map<K,V> getReplicatedMap(String name) { + public <K, V> Map<K, V> getReplicatedMap(String name) { return hzInstance.getReplicatedMap(name); } diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index 992df9f4a30..5f50464eb51 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -52,10 +52,11 @@ import org.sonar.ce.log.CeProcessLogging; import org.sonar.ce.platform.ComputeEngineExtensionInstaller; import org.sonar.ce.queue.CeQueueCleaner; import org.sonar.ce.queue.PurgeCeActivities; -import org.sonar.ce.settings.ProjectSettingsFactory; +import org.sonar.ce.settings.ProjectConfigurationFactory; import org.sonar.ce.taskprocessor.CeTaskProcessorModule; import org.sonar.ce.user.CeUserSession; import org.sonar.core.component.DefaultResourceTypes; +import org.sonar.core.config.ConfigurationProvider; import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.core.i18n.DefaultI18n; import org.sonar.core.i18n.RuleI18nManager; @@ -181,12 +182,10 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { if (props.valueAsBoolean("sonar.cluster.enabled")) { this.level4.add( HazelcastClientWrapperImpl.class, - CeDistributedInformationImpl.class - ); + CeDistributedInformationImpl.class); } else { this.level4.add( - StandaloneCeDistributedInformation.class - ); + StandaloneCeDistributedInformation.class); } configureFromModules(this.level4); ServerExtensionInstaller extensionInstaller = this.level4.getComponentByType(ServerExtensionInstaller.class); @@ -225,6 +224,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { Version apiVersion = ApiVersion.load(System2.INSTANCE); return new Object[] { ThreadLocalSettings.class, + new ConfigurationProvider(), new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(ApiVersion.load(System2.INSTANCE), SonarQubeSide.COMPUTE_ENGINE), CeProcessLogging.class, @@ -406,7 +406,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { CeTaskProcessorModule.class, InternalPropertiesImpl.class, - ProjectSettingsFactory.class, + ProjectConfigurationFactory.class, // cleaning CeCleaningModule.class |