BUG-1173: ensure compatibility with Guava 17+ 20/15320/2
authorRobert Varga <rovarga@cisco.com>
Mon, 9 Jun 2014 17:35:21 +0000 (19:35 +0200)
committerRobert Varga <rovarga@cisco.com>
Sat, 14 Feb 2015 10:33:33 +0000 (11:33 +0100)
This migrates the sole user to the Guava-15+ API, as the API is removed
in version 17.

Change-Id: I3bf52fb89116024e7305a142e6b1f6fec9985488
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImplTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java

index 0fed63098d6da1edfb6229245ffd63d1e4e4b7df..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;
 
index 3dc6ae469a932474effca186c956a7a6f4ec8631..1f446c72f1ee9eccef904866236c1ec5ea235fb9 100644 (file)
@@ -126,8 +126,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
     private void initRecoveryTimer() {
         if(recoveryTimer == null) {
-            recoveryTimer = new Stopwatch();
-            recoveryTimer.start();
+            recoveryTimer = Stopwatch.createStarted();
         }
     }
 
@@ -190,8 +189,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         context.setLastApplied(snapshot.getLastAppliedIndex());
         context.setCommitIndex(snapshot.getLastAppliedIndex());
 
-        Stopwatch timer = new Stopwatch();
-        timer.start();
+        Stopwatch timer = Stopwatch.createStarted();
 
         // Apply the snapshot to the actors state
         applyRecoverySnapshot(snapshot.getState());
index a092c46533d251414ee7f22cf843c4fc3765f691..84d1545a65e3302462b69f9ee96f8dd982955654 100644 (file)
@@ -55,8 +55,7 @@ public class FollowerLogInformationImplTest {
     // hence getting the actual elapsed time and do a match.
     // if the sleep has spilled over, then return the test gracefully
     private long sleepWithElaspsedTimeReturned(long millis) {
-        Stopwatch stopwatch = new Stopwatch();
-        stopwatch.start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         Uninterruptibles.sleepUninterruptibly(millis, TimeUnit.MILLISECONDS);
         stopwatch.stop();
         return stopwatch.elapsed(TimeUnit.MILLISECONDS);
index 8ae2a8657d2ec05abd439c6f60376d28b4516114..b9d44b2586f75a34b163322f9888b94419dd7cee 100644 (file)
@@ -80,8 +80,7 @@ public class MutableCompositeModificationTest extends AbstractModificationTest {
             compositeModification.addModification(new WriteModification(writePath, writeData));
         }
 
-        Stopwatch sw = new Stopwatch();
-        sw.start();
+        Stopwatch sw = Stopwatch.createStarted();
         for(int i = 0; i < 1000; i++) {
             new ModificationPayload(compositeModification);
         }
index 72534e242e92dc4a4d8a19690caecd0fcf5d0cdd..ab731260216f4452f6ba3d5e8c6b64c8179bdad2 100644 (file)
@@ -84,7 +84,7 @@ public class SSHTest {
 
         final EchoClientHandler echoClientHandler = connectClient(addr);
 
-        Stopwatch stopwatch = new Stopwatch().start();
+        Stopwatch stopwatch = Stopwatch.createStarted();
         while(echoClientHandler.isConnected() == false && stopwatch.elapsed(TimeUnit.SECONDS) < 30) {
             Thread.sleep(500);
         }
@@ -131,7 +131,7 @@ public class SSHTest {
     public void testClientWithoutServer() throws Exception {
         final InetSocketAddress address = new InetSocketAddress(12345);
         final EchoClientHandler echoClientHandler = connectClient(address);
-        final Stopwatch stopwatch = new Stopwatch().start();
+        final Stopwatch stopwatch = Stopwatch.createStarted();
         while(echoClientHandler.getState() == State.CONNECTING && stopwatch.elapsed(TimeUnit.SECONDS) < 5) {
             Thread.sleep(100);
         }