+
+ Configuration fromTemplateConfig = null;
+ /*
+ * Fetch transactional/non-transactional templates
+ */
+ // Check if transactional
+ if (cMode.contains(IClusterServices.cacheMode.TRANSACTIONAL)) {
+ fromTemplateConfig = manager.getCacheConfiguration("transactional-type");
+ } else if (cMode.contains(IClusterServices.cacheMode.NON_TRANSACTIONAL)) {
+ fromTemplateConfig = manager.getDefaultCacheConfiguration();
+ }
+
+ // If none set the transactional property then just return null
+ if (fromTemplateConfig == null) {
+ return null;
+ }
+
+ ConfigurationBuilder builder = new ConfigurationBuilder();
+ builder.read(fromTemplateConfig);
+ /*
+ * Now evaluate async/sync
+ */
+ if (cMode.contains(IClusterServices.cacheMode.ASYNC)) {
+ builder.clustering()
+ .cacheMode(fromTemplateConfig.clustering()
+ .cacheMode()
+ .toAsync());
+ } else if (cMode.contains(IClusterServices.cacheMode.SYNC)) {
+ builder.clustering()
+ .cacheMode(fromTemplateConfig.clustering()
+ .cacheMode()
+ .toSync());
+ }
+
+ manager.defineConfiguration(realCacheName, builder.build());
+ c = manager.getCache(realCacheName);
+ return c;