ARTEMIS-914 use defaults for ReplicaPolicy

This commit is contained in:
Justin Bertram 2017-01-11 11:40:13 -06:00 committed by Clebert Suconic
parent 0386263c83
commit 22c6a81135
2 changed files with 14 additions and 2 deletions

View File

@ -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,

View File

@ -48,7 +48,7 @@ public class ReplicatedPolicy implements HAPolicy<LiveActivation> {
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<LiveActivation> {
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;
}