X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDistributedDataStore.java;h=198c3b2edaa137e6a2b6c5d32d14a1b00798106b;hb=d3358dde361ed5bd94466ded15dac0bba45afe9c;hp=4fd707e0654f8e1a963a2fcc34424978be102a0c;hpb=0e1824a2f55e35c5b6cfd0407e27dbe1a7c54cf3;p=controller.git 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 4fd707e065..198c3b2eda 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 @@ -20,6 +20,7 @@ import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIde import org.opendaylight.controller.cluster.datastore.jmx.mbeans.DatastoreConfigurationMXBeanImpl; import org.opendaylight.controller.cluster.datastore.jmx.mbeans.DatastoreInfoMXBeanImpl; import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot; +import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManagerCreator; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.cluster.datastore.utils.Dispatchers; import org.opendaylight.controller.cluster.datastore.utils.PrimaryShardInfoFutureCache; @@ -85,11 +86,11 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, PrimaryShardInfoFutureCache primaryShardInfoCache = new PrimaryShardInfoFutureCache(); - ShardManager.Builder builder = ShardManager.builder().cluster(cluster).configuration(configuration). + ShardManagerCreator creator = new ShardManagerCreator().cluster(cluster).configuration(configuration). datastoreContextFactory(datastoreContextFactory).waitTillReadyCountdownLatch(waitTillReadyCountDownLatch). primaryShardInfoCache(primaryShardInfoCache).restoreFromSnapshot(restoreFromSnapshot); - actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, builder, shardDispatcher, + actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, creator, shardDispatcher, shardManagerId), cluster, configuration, datastoreContextFactory.getBaseDatastoreContext(), primaryShardInfoCache); this.waitTillReadyTimeInMillis = @@ -185,7 +186,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, @Override public void onDatastoreContextUpdated(DatastoreContextFactory contextFactory) { - LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreType()); + LOG.info("DatastoreContext updated for data store {}", actorContext.getDataStoreName()); actorContext.setDatastoreContext(contextFactory); datastoreConfigMXBean.setContext(contextFactory.getBaseDatastoreContext()); @@ -193,6 +194,8 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, @Override public void close() { + LOG.info("Closing data store {}", type); + if (datastoreConfigMXBean != null) { datastoreConfigMXBean.unregisterMBean(); } @@ -230,14 +233,14 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, } } - private ActorRef createShardManager(ActorSystem actorSystem, ShardManager.Builder builder, String shardDispatcher, - String shardManagerId){ + private static ActorRef createShardManager(ActorSystem actorSystem, ShardManagerCreator creator, + String shardDispatcher, String shardManagerId) { Exception lastException = null; for(int i=0;i<100;i++) { try { - return actorSystem.actorOf(builder.props().withDispatcher(shardDispatcher).withMailbox( - ActorContext.MAILBOX), shardManagerId); + return actorSystem.actorOf(creator.props().withDispatcher(shardDispatcher).withMailbox( + ActorContext.BOUNDED_MAILBOX), shardManagerId); } catch (Exception e){ lastException = e; Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);