Fix settle wait strategy 14/16914/2
authorRobert Varga <rovarga@cisco.com>
Fri, 20 Mar 2015 12:10:17 +0000 (13:10 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 20 Mar 2015 12:33:18 +0000 (13:33 +0100)
CountDownLatch time expiration is not reported via exception, so the
reporting code was wrong.

Change-Id: Ic8b0ea7fd50cbcb3d03710ae3949f2447534fe1f
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java

index 3029ef7e399a4db99c6ed2ad18a7e7701cb2f8ee..5ade98cb86106a7b65d82251dccced95c93f0914 100644 (file)
@@ -178,11 +178,13 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener,
         LOG.info("Beginning to wait for data store to become ready : {}", type);
 
         try {
-            waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS);
-
-            LOG.debug("Data store {} is now ready", type);
+            if (waitTillReadyCountDownLatch.await(waitTillReadyTimeInMillis, TimeUnit.MILLISECONDS)) {
+                LOG.debug("Data store {} is now ready", type);
+            } else {
+                LOG.error("Shared leaders failed to settle in {} seconds, giving up", TimeUnit.MILLISECONDS.toSeconds(waitTillReadyTimeInMillis));
+            }
         } catch (InterruptedException e) {
-            LOG.error("Interrupted when trying to wait for shards to become leader in a reasonable amount of time - giving up");
+            LOG.error("Interrupted while waiting for shards to settle", e);
         }
     }