- public static DistributedDataStore createInstance(String name, SchemaService schemaService){
- ActorSystem actorSystem = ActorSystemFactory.getInstance();
- final DistributedDataStore dataStore =
- new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem), new ConfigurationImpl("module-shards.conf", "modules.conf"));
- schemaService
- .registerSchemaServiceListener(dataStore);
+ private static final String ACTOR_SYSTEM_NAME = "opendaylight-cluster-data";
+ private static final String CONFIGURATION_NAME = "odl-cluster-data";
+
+ private static volatile ActorSystem persistentActorSystem = null;
+
+ public static DistributedDataStore createInstance(SchemaService schemaService,
+ DatastoreContext datastoreContext, BundleContext bundleContext) {
+
+ DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(datastoreContext);
+ DatastoreContextConfigAdminOverlay overlay = new DatastoreContextConfigAdminOverlay(
+ introspector, bundleContext);
+
+ ActorSystem actorSystem = getOrCreateInstance(bundleContext, datastoreContext.getConfigurationReader());
+ Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
+ final DistributedDataStore dataStore = new DistributedDataStore(actorSystem,
+ new ClusterWrapperImpl(actorSystem), config, introspector.getContext());
+
+ overlay.setListener(dataStore);
+
+ ShardStrategyFactory.setConfiguration(config);
+ schemaService.registerSchemaContextListener(dataStore);
+
+ dataStore.setCloseable(overlay);
+ dataStore.waitTillReady();