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=1b87f44f846ed3238aae637c905062183d85e07a;hb=27966a20f38fa6771b56936137a3a857474a91ef;hp=3e6742c17d37c178d30c7d570490ff993c068806;hpb=69343f4c1b9fee2e28186fb7bd4482bf7d4614cd;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..1b87f44f84 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,15 +43,19 @@ 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 private int snapshotDataThresholdPercentage = 12; + private int snaphotChunkSize = SNAPSHOT_CHUNK_SIZE; + private long electionTimeoutFactor = 2; public void setHeartBeatInterval(FiniteDuration heartBeatInterval) { this.heartBeatInterval = heartBeatInterval; + electionTimeOutInterval = null; } public void setSnapshotBatchCount(long snapshotBatchCount) { @@ -62,6 +66,10 @@ public class DefaultConfigParamsImpl implements ConfigParams { this.snapshotDataThresholdPercentage = snapshotDataThresholdPercentage; } + public void setSnaphotChunkSize(int snaphotChunkSize) { + this.snaphotChunkSize = snaphotChunkSize; + } + public void setJournalRecoveryLogBatchSize(int journalRecoveryLogBatchSize) { this.journalRecoveryLogBatchSize = journalRecoveryLogBatchSize; } @@ -72,6 +80,7 @@ public class DefaultConfigParamsImpl implements ConfigParams { public void setElectionTimeoutFactor(long electionTimeoutFactor){ this.electionTimeoutFactor = electionTimeoutFactor; + electionTimeOutInterval = null; } @Override @@ -92,7 +101,11 @@ public class DefaultConfigParamsImpl implements ConfigParams { @Override public FiniteDuration getElectionTimeOutInterval() { - return getHeartBeatInterval().$times(electionTimeoutFactor); + if(electionTimeOutInterval == null) { + electionTimeOutInterval = getHeartBeatInterval().$times(electionTimeoutFactor); + } + + return electionTimeOutInterval; } @Override @@ -102,7 +115,7 @@ public class DefaultConfigParamsImpl implements ConfigParams { @Override public int getSnapshotChunkSize() { - return SNAPSHOT_CHUNK_SIZE; + return snaphotChunkSize; } @Override