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 283aa8f142087c2421f58d7a116351652c58575f..873b8514a2e30038f4327a01507df063b2468211 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 = {}, "