diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-09-06 14:25:21 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-09-13 15:50:51 +0200 |
commit | 7ad97d0f0cdd473d0fb294bd099109dbc2580b1e (patch) | |
tree | d54e75d670de854b1ab488f78d92f5c5d55cf7c6 /server | |
parent | 55de8d527c66d2a7d87014f89415346722c78644 (diff) | |
download | sonarqube-7ad97d0f0cdd473d0fb294bd099109dbc2580b1e.tar.gz sonarqube-7ad97d0f0cdd473d0fb294bd099109dbc2580b1e.zip |
SONAR-9741 populate default value of sonar.cluster.node.name
and propagate it through main process and sub processes
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-cluster/src/main/java/org/sonar/cluster/ClusterProperties.java | 2 | ||||
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/cluster/ClusterProperties.java | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/server/sonar-cluster/src/main/java/org/sonar/cluster/ClusterProperties.java b/server/sonar-cluster/src/main/java/org/sonar/cluster/ClusterProperties.java index 018150341f8..ebbb86fd875 100644 --- a/server/sonar-cluster/src/main/java/org/sonar/cluster/ClusterProperties.java +++ b/server/sonar-cluster/src/main/java/org/sonar/cluster/ClusterProperties.java @@ -20,6 +20,7 @@ package org.sonar.cluster; import java.util.Properties; +import java.util.UUID; import static java.lang.String.valueOf; @@ -49,6 +50,7 @@ public final class ClusterProperties { properties.put(CLUSTER_NODE_HOST, ""); properties.put(CLUSTER_HOSTS, ""); properties.put(CLUSTER_NODE_PORT, "9003"); + properties.put(CLUSTER_NODE_NAME, "sonarqube-" + UUID.randomUUID().toString()); properties.put(HAZELCAST_LOG_LEVEL, "WARN"); } } diff --git a/server/sonar-main/src/main/java/org/sonar/application/cluster/ClusterProperties.java b/server/sonar-main/src/main/java/org/sonar/application/cluster/ClusterProperties.java index a197b7bd4e0..bb25b4f9a0b 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/cluster/ClusterProperties.java +++ b/server/sonar-main/src/main/java/org/sonar/application/cluster/ClusterProperties.java @@ -26,7 +26,6 @@ import java.net.SocketException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; -import java.util.UUID; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; @@ -56,10 +55,10 @@ final class ClusterProperties { ClusterProperties(AppSettings appSettings) { port = appSettings.getProps().valueAsInt(CLUSTER_NODE_PORT); - networkInterfaces = extractNetworkInterfaces(appSettings.getProps().value(CLUSTER_NODE_HOST, "")); - hosts = extractHosts(appSettings.getProps().value(CLUSTER_HOSTS, "")); - nodeType = NodeType.parse(appSettings.getProps().value(CLUSTER_NODE_TYPE)); - nodeName = appSettings.getProps().value(CLUSTER_NODE_NAME, "sonarqube-" + UUID.randomUUID().toString()); + networkInterfaces = extractNetworkInterfaces(appSettings.getProps().nonNullValue(CLUSTER_NODE_HOST)); + hosts = extractHosts(appSettings.getProps().nonNullValue(CLUSTER_HOSTS)); + nodeType = NodeType.parse(appSettings.getProps().nonNullValue(CLUSTER_NODE_TYPE)); + nodeName = appSettings.getProps().nonNullValue(CLUSTER_NODE_NAME); } int getPort() { |