BUG-8618: refactor SyncStatusTracker state
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
index b78c4fac223dcda8d98a8571dfa9cf4a33f28ba6..883bfbb4e4184f0cbf0843002dfa3498ca13f622 100644 (file)
@@ -66,8 +66,13 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public long decrNextIndex() {
-        return nextIndex--;
+    public boolean decrNextIndex() {
+        if (nextIndex >= 0) {
+            nextIndex--;
+            return true;
+        }
+
+        return false;
     }
 
     @Override
@@ -200,6 +205,8 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
 
     @Override
     public void clearLeaderInstallSnapshotState() {
+        Preconditions.checkState(installSnapshotState != null);
+        installSnapshotState.close();
         installSnapshotState = null;
     }