Bug 2731: Discard changes only when transaction exist.
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
index 7a690d3d18be84433f9e37c874a88b277b83f7cb..935c4f0bbd7495de286196a0ce65e2502cf93f95 100644 (file)
@@ -19,7 +19,7 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
 
     private final String id;
 
-    private final Stopwatch stopwatch = new Stopwatch();
+    private final Stopwatch stopwatch = Stopwatch.createUnstarted();
 
     private final long followerTimeoutMillis;
 
@@ -95,4 +95,9 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
             stopwatch.stop();
         }
     }
+
+    @Override
+    public long timeSinceLastActivity() {
+        return stopwatch.elapsed(TimeUnit.MILLISECONDS);
+    }
 }