Simplify recoveryTime computation 58/82458/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 7 Jun 2019 22:44:58 +0000 (00:44 +0200)
committerRobert Varga <nite@hq.sk>
Sun, 9 Jun 2019 21:56:14 +0000 (21:56 +0000)
Stopwatch.stop() returns self, take advantage of that to shorted
the code to compute the formatting string. Also drop toString()
call, as it is implied by string concat.

Change-Id: I4fa645e42fc38b5f9f0775d986fd17aa693725b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java

index 283aa8f..873b851 100644 (file)
@@ -246,11 +246,12 @@ class RaftActorRecoverySupport {
             endCurrentLogRecoveryBatch();
         }
 
-        String recoveryTime = "";
+        final String recoveryTime;
         if (recoveryTimer != null) {
-            recoveryTimer.stop();
-            recoveryTime = " in " + recoveryTimer.toString();
+            recoveryTime = " in " + recoveryTimer.stop();
             recoveryTimer = null;
+        } else {
+            recoveryTime = "";
         }
 
         log.info("{}: Recovery completed {} - Switching actor to Follower - last log index = {}, last log term = {}, "

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.