Use instanceof pattern
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / DefaultConfigParamsImpl.java
index 97838b03212f8ea8b3fbd6201995b398a9b61977..0d65fa2ea1272a9ee77567cc493c7bd464b9ba27 100644 (file)
@@ -41,7 +41,7 @@ public class DefaultConfigParamsImpl implements ConfigParams {
      */
     private static final int ELECTION_TIME_MAX_VARIANCE = 100;
 
-    private static final int SNAPSHOT_CHUNK_SIZE = 2048 * 1000; //2MB
+    private static final int SNAPSHOT_CHUNK_SIZE = 480 * 1024; // 480KiB
 
 
     /**
@@ -68,6 +68,10 @@ public class DefaultConfigParamsImpl implements ConfigParams {
     // in-memory journal can use before it needs to snapshot
     private int snapshotDataThresholdPercentage = 12;
 
+    // max size of in-memory journal in MB
+    // 0 means direct threshold if disabled
+    private int snapshotDataThreshold = 0;
+
     private int snapshotChunkSize = SNAPSHOT_CHUNK_SIZE;
 
     private long electionTimeoutFactor = 2;
@@ -91,15 +95,19 @@ public class DefaultConfigParamsImpl implements ConfigParams {
         this.snapshotBatchCount = snapshotBatchCount;
     }
 
-    public void setRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval) {
+    public void setRecoverySnapshotIntervalSeconds(final int recoverySnapshotInterval) {
         checkArgument(recoverySnapshotInterval >= 0);
-        this.recoverySnapshotIntervalSeconds = recoverySnapshotInterval;
+        recoverySnapshotIntervalSeconds = recoverySnapshotInterval;
     }
 
     public void setSnapshotDataThresholdPercentage(final int snapshotDataThresholdPercentage) {
         this.snapshotDataThresholdPercentage = snapshotDataThresholdPercentage;
     }
 
+    public void setSnapshotDataThreshold(final int snapshotDataThreshold) {
+        this.snapshotDataThreshold = snapshotDataThreshold;
+    }
+
     public void setSnapshotChunkSize(final int snapshotChunkSize) {
         this.snapshotChunkSize = snapshotChunkSize;
     }
@@ -148,9 +156,14 @@ public class DefaultConfigParamsImpl implements ConfigParams {
         return snapshotDataThresholdPercentage;
     }
 
+    @Override
+    public int getSnapshotDataThreshold() {
+        return snapshotDataThreshold;
+    }
+
     @Override
     public int getRecoverySnapshotIntervalSeconds() {
-        return this.recoverySnapshotIntervalSeconds;
+        return recoverySnapshotIntervalSeconds;
     }
 
     @Override