[exo-jcr-commits] exo-jcr SVN: r2914 - kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Aug 13 08:22:34 EDT 2010
Author: nfilotto
Date: 2010-08-13 08:22:34 -0400 (Fri, 13 Aug 2010)
New Revision: 2914
Modified:
kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
Log:
EXOJCR-802: In case several caches use the same custom configuration, the same cache manger will be used
Modified: kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2010-08-13 11:56:46 UTC (rev 2913)
+++ kernel/branches/2.3-ISPN/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2010-08-13 12:22:34 UTC (rev 2914)
@@ -95,6 +95,11 @@
* The mapping between the cache names and the configuration paths
*/
private final Map<String, String> mappingCacheNameConfig = new HashMap<String, String>();
+
+ /**
+ * The mapping between the configuration paths and the cache managers
+ */
+ private final Map<String, DefaultCacheManager> mappingConfigPathCacheManager = new HashMap<String, DefaultCacheManager>();
/**
* The default creator
@@ -245,8 +250,14 @@
// A custom configuration has been set
if (LOG.isInfoEnabled())
LOG.info("A custom configuration has been set for the cache '" + region + "'.");
- DefaultCacheManager cacheManager =
- new DefaultCacheManager(configManager.getInputStream(customConfig), false);
+ DefaultCacheManager cacheManager = mappingConfigPathCacheManager.get(customConfig);
+ if (cacheManager == null)
+ {
+ // No cache manager has been defined so far for this configuration file
+ cacheManager = new DefaultCacheManager(configManager.getInputStream(customConfig), false);
+ // We register this new cache manager
+ mappingConfigPathCacheManager.put(customConfig, cacheManager);
+ }
conf = cacheManager.getDefaultConfiguration().clone();
}
else
More information about the exo-jcr-commits
mailing list