diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-21 15:45:30 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-26 23:49:38 +0200 |
commit | b3968feb20e92cdc5c3252bf922293877e8b65df (patch) | |
tree | d6fc5d553885aa3fec3a0939fe29ba83c792bc43 /server/sonar-process | |
parent | e401e830cd5eb2c52ad1a2749bd3cb9a3a2690b6 (diff) | |
download | sonarqube-b3968feb20e92cdc5c3252bf922293877e8b65df.tar.gz sonarqube-b3968feb20e92cdc5c3252bf922293877e8b65df.zip |
SONAR-9802 fix support of overridden cluster name
Diffstat (limited to 'server/sonar-process')
3 files changed, 5 insertions, 9 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java index 55a5dd0a4ed..73ba63abfa4 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java +++ b/server/sonar-process/src/main/java/org/sonar/process/cluster/hz/HazelcastMemberBuilder.java @@ -41,7 +41,6 @@ import static java.util.Objects.requireNonNull; public class HazelcastMemberBuilder { - private String clusterName; private String nodeName; private int port; private NodeType nodeType; @@ -49,11 +48,6 @@ public class HazelcastMemberBuilder { private String networkInterface; private List<String> members = new ArrayList<>(); - public HazelcastMemberBuilder setClusterName(String s) { - this.clusterName = s; - return this; - } - public HazelcastMemberBuilder setNodeName(String s) { this.nodeName = s; return this; @@ -97,7 +91,11 @@ public class HazelcastMemberBuilder { public HazelcastMember build() { Config config = new Config(); - config.getGroupConfig().setName(requireNonNull(clusterName, "Cluster name is missing")); + // do not use the value defined by property sonar.cluster.name. + // Hazelcast does not fail when joining a cluster with different name. + // Apparently this behavior exists since Hazelcast 3.8.2 (see note + // at http://docs.hazelcast.org/docs/3.8.6/manual/html-single/index.html#creating-cluster-groups) + config.getGroupConfig().setName("SonarQube"); // Configure network NetworkConfig netConfig = config.getNetworkConfig(); diff --git a/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberBuilderTest.java b/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberBuilderTest.java index 6a4973b8d13..b01223d7616 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberBuilderTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberBuilderTest.java @@ -47,7 +47,6 @@ public class HazelcastMemberBuilderTest { HazelcastMember member = underTest .setNodeType(NodeType.APPLICATION) .setProcessId(ProcessId.COMPUTE_ENGINE) - .setClusterName("foo") .setNodeName("bar") .setPort(NetworkUtilsImpl.INSTANCE.getNextAvailablePort(loopback)) .setNetworkInterface(loopback.getHostAddress()) diff --git a/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberImplTest.java b/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberImplTest.java index 4d83a82f233..3bf649baecd 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberImplTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/cluster/hz/HazelcastMemberImplTest.java @@ -114,7 +114,6 @@ public class HazelcastMemberImplTest { return new HazelcastMemberBuilder() .setNodeType(NodeType.APPLICATION) .setProcessId(ProcessId.COMPUTE_ENGINE) - .setClusterName("foo") .setNodeName("name" + port) .setPort(port) .setNetworkInterface(loopback.getHostAddress()) |