コード例 #1
0
 private Map<CacheCategory, CacheService> createCaches(CacheInfo cacheInfo) {
   Map<CacheCategory, CacheService> ciCaches = new HashMap<CacheCategory, CacheService>();
   for (Map.Entry<CacheCategory, CacheConfiguration> entry :
       cacheInfo.getConfiguration().entrySet()) {
     if (entry.getValue() instanceof InfinispanConfiguration) {
       CacheService cacheService;
       CacheCategory category = entry.getKey();
       InfinispanConfiguration config = (InfinispanConfiguration) entry.getValue();
       if (config.isCacheEnabled()) {
         String configurationName = config.getConfigurationName();
         if (null == configurationName) {
           Configuration dcc = manager.getDefaultCacheConfiguration();
           Configuration infinispan =
               config.getInfinispanConfiguration(new ConfigurationBuilder().read(dcc));
           configurationName = "$" + category.getName() + "$" + cacheInfo.getId();
           manager.defineConfiguration(configurationName, infinispan);
         }
         recorder.record("infinispan", "configuration name " + configurationName);
         cacheService =
             new InfinispanCacheService(manager.<String, Object>getCache(configurationName));
       } else {
         cacheService = noCacheFactory.create(null, category);
       }
       ciCaches.put(category, cacheService);
     }
   }
   return ciCaches;
 }
コード例 #2
0
 /**
  * Create a {@link CacheSelector}.
  *
  * @param category category
  * @param layer layer
  */
 public CacheSelector(CacheCategory category, Layer layer) {
   if (null != category) {
     this.category = category.toString();
   }
   if (null != layer) {
     this.layer = layer.getId();
   }
 }