- final DistributedDataStore dataStore =
- new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem),
- config, datastoreContext);
-
- ShardStrategyFactory.setConfiguration(config);
- schemaService.registerSchemaContextListener(dataStore);
- return dataStore;
- }
-
- synchronized private static final ActorSystem getOrCreateInstance(final BundleContext bundleContext, ConfigurationReader configurationReader) {
-
- AtomicReference<ActorSystem> actorSystemReference = persistentActorSystem;
- String configurationName = CONFIGURATION_NAME;
- String actorSystemName = ACTOR_SYSTEM_NAME;
-
- if (actorSystemReference.get() != null){
- return actorSystemReference.get();
+ ClusterWrapper clusterWrapper = new ClusterWrapperImpl(actorSystem);
+ DatastoreContextFactory contextFactory = introspector.newContextFactory();
+
+ final AbstractDataStore dataStore;
+ if (datastoreContext.isUseTellBasedProtocol()) {
+ dataStore = new ClientBackedDataStore(actorSystem, clusterWrapper, config, contextFactory,
+ restoreFromSnapshot);
+ LOG.info("Data store {} is using tell-based protocol", datastoreContext.getDataStoreName());
+ } else {
+ dataStore = new DistributedDataStore(actorSystem, clusterWrapper, config, contextFactory,
+ restoreFromSnapshot);