From 22c6a81135c3a4be17d7990ff2c3c54029dbdd2f Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Wed, 11 Jan 2017 11:40:13 -0600 Subject: [PATCH] ARTEMIS-914 use defaults for ReplicaPolicy --- .../artemis/core/server/cluster/ha/ReplicaPolicy.java | 6 ++++++ .../core/server/cluster/ha/ReplicatedPolicy.java | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java index 89e7ab8484..68db06eab8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java @@ -47,6 +47,12 @@ public class ReplicaPolicy extends BackupPolicy { this.networkHealthCheck = networkHealthCheck; } + public ReplicaPolicy(final NetworkHealthCheck networkHealthCheck, + ReplicatedPolicy replicatedPolicy) { + this.networkHealthCheck = networkHealthCheck; + this.replicatedPolicy = replicatedPolicy; + } + public ReplicaPolicy(String clusterName, int maxSavedReplicatedJournalsSize, String groupName, diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java index f74321917d..82df79c526 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java @@ -48,7 +48,7 @@ public class ReplicatedPolicy implements HAPolicy { private final NetworkHealthCheck networkHealthCheck; public ReplicatedPolicy(NetworkHealthCheck networkHealthCheck) { - replicaPolicy = new ReplicaPolicy(clusterName, -1, groupName, this, networkHealthCheck); + replicaPolicy = new ReplicaPolicy(networkHealthCheck, this); this.networkHealthCheck = networkHealthCheck; } @@ -122,7 +122,13 @@ public class ReplicatedPolicy implements HAPolicy { public ReplicaPolicy getReplicaPolicy() { if (replicaPolicy == null) { - replicaPolicy = new ReplicaPolicy(clusterName, -1, groupName, this, networkHealthCheck); + replicaPolicy = new ReplicaPolicy(networkHealthCheck, this); + if (clusterName != null && clusterName.length() > 0) { + replicaPolicy.setClusterName(clusterName); + } + if (groupName != null && groupName.length() > 0) { + replicaPolicy.setGroupName(groupName); + } } return replicaPolicy; }