X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FDefaultConfigParamsImpl.java;h=d4d13899eb770e4ee8bb88a634dd85ec2cfb7bbc;hb=d1d24d3742ffcda5e16a1d35e15a5627d5eb05f9;hp=3e6742c17d37c178d30c7d570490ff993c068806;hpb=b5e3b3f436f8534ddb6c7f326ccbef995b96ddc3;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java index 3e6742c17d..d4d13899eb 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java @@ -43,6 +43,7 @@ public class DefaultConfigParamsImpl implements ConfigParams { private long snapshotBatchCount = SNAPSHOT_BATCH_COUNT; private int journalRecoveryLogBatchSize = JOURNAL_RECOVERY_LOG_BATCH_SIZE; private long isolatedLeaderCheckInterval = HEART_BEAT_INTERVAL.$times(1000).toMillis(); + private FiniteDuration electionTimeOutInterval; // 12 is just an arbitrary percentage. This is the amount of the total memory that a raft actor's // in-memory journal can use before it needs to snapshot @@ -52,6 +53,7 @@ public class DefaultConfigParamsImpl implements ConfigParams { public void setHeartBeatInterval(FiniteDuration heartBeatInterval) { this.heartBeatInterval = heartBeatInterval; + electionTimeOutInterval = null; } public void setSnapshotBatchCount(long snapshotBatchCount) { @@ -72,6 +74,7 @@ public class DefaultConfigParamsImpl implements ConfigParams { public void setElectionTimeoutFactor(long electionTimeoutFactor){ this.electionTimeoutFactor = electionTimeoutFactor; + electionTimeOutInterval = null; } @Override @@ -92,7 +95,11 @@ public class DefaultConfigParamsImpl implements ConfigParams { @Override public FiniteDuration getElectionTimeOutInterval() { - return getHeartBeatInterval().$times(electionTimeoutFactor); + if(electionTimeOutInterval == null) { + electionTimeOutInterval = getHeartBeatInterval().$times(electionTimeoutFactor); + } + + return electionTimeOutInterval; } @Override