X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDistributedDataStore.java;h=c79de945675a0f14d8a40fd6dc13f4007a3a9669;hp=3029ef7e399a4db99c6ed2ad18a7e7701cb2f8ee;hb=08dd5c2c443ff53f56af88a0e8dc8f34e36d2245;hpb=7f44a5812395762479de68d339c3d017db6c0e9d diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java index 3029ef7e39..c79de94567 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java @@ -15,6 +15,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIdentifier; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.DatastoreConfigurationMXBeanImpl; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.DatastoreInfoMXBeanImpl; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.cluster.datastore.utils.Dispatchers; @@ -52,7 +53,9 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, private DatastoreConfigurationMXBeanImpl datastoreConfigMXBean; - private CountDownLatch waitTillReadyCountDownLatch = new CountDownLatch(1); + private DatastoreInfoMXBeanImpl datastoreInfoMXBean; + + private final CountDownLatch waitTillReadyCountDownLatch = new CountDownLatch(1); private final String type; @@ -84,6 +87,9 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, datastoreConfigMXBean = new DatastoreConfigurationMXBeanImpl(datastoreContext.getDataStoreMXBeanType()); datastoreConfigMXBean.setContext(datastoreContext); datastoreConfigMXBean.registerMBean(); + + datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContext.getDataStoreMXBeanType(), actorContext); + datastoreInfoMXBean.registerMBean(); } public DistributedDataStore(ActorContext actorContext) { @@ -157,6 +163,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, @Override public void close() { datastoreConfigMXBean.unregisterMBean(); + datastoreInfoMXBean.unregisterMBean(); if(closeable != null) { try { @@ -178,11 +185,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); } }