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;
Preconditions.checkNotNull(configuration, "configuration should not be null");
Preconditions.checkNotNull(datastoreContextFactory, "datastoreContextFactory should not be null");
- this.type = datastoreContextFactory.getBaseDatastoreContext().getDataStoreType();
+ this.type = datastoreContextFactory.getBaseDatastoreContext().getDataStoreName();
String shardManagerId = ShardManagerIdentifier.builder().type(type).build().toString();
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 =
@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());
@Override
public void close() {
+ LOG.info("Closing data store {}", type);
+
if (datastoreConfigMXBean != null) {
datastoreConfigMXBean.unregisterMBean();
}
}
}
- 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);