Hide internals of FollowerLogInformationImpl
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
index 7df80af58a717e99c1a226c3bd6cbb17ccd92afc..9820638ab706ba0753da5ff1d574bc657da9b962 100644 (file)
@@ -14,7 +14,7 @@ import scala.concurrent.duration.FiniteDuration;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
-public class FollowerLogInformationImpl implements FollowerLogInformation{
+public class FollowerLogInformationImpl implements FollowerLogInformation {
 
     private final String id;
 
@@ -26,11 +26,11 @@ public class FollowerLogInformationImpl implements FollowerLogInformation{
 
     private final long followerTimeoutMillis;
 
-    public FollowerLogInformationImpl(String id, AtomicLong nextIndex,
-        AtomicLong matchIndex, FiniteDuration followerTimeoutDuration) {
+    public FollowerLogInformationImpl(String id, long nextIndex,
+        long matchIndex, FiniteDuration followerTimeoutDuration) {
         this.id = id;
-        this.nextIndex = nextIndex;
-        this.matchIndex = matchIndex;
+        this.nextIndex = new AtomicLong(nextIndex);
+        this.matchIndex = new AtomicLong(matchIndex);
         this.stopwatch = new Stopwatch();
         this.followerTimeoutMillis = followerTimeoutDuration.toMillis();
     }
@@ -39,11 +39,13 @@ public class FollowerLogInformationImpl implements FollowerLogInformation{
         return nextIndex.incrementAndGet();
     }
 
-    @Override public long decrNextIndex() {
+    @Override
+    public long decrNextIndex() {
         return nextIndex.decrementAndGet();
     }
 
-    @Override public void setNextIndex(long nextIndex) {
+    @Override
+    public void setNextIndex(long nextIndex) {
         this.nextIndex.set(nextIndex);
     }
 
@@ -51,7 +53,8 @@ public class FollowerLogInformationImpl implements FollowerLogInformation{
         return matchIndex.incrementAndGet();
     }
 
-    @Override public void setMatchIndex(long matchIndex) {
+    @Override
+    public void setMatchIndex(long matchIndex) {
         this.matchIndex.set(matchIndex);
     }