[exo-jcr-commits] exo-jcr SVN: r4809 - in kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src: test/java/org/exoplatform/services/cache/impl/jboss and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Aug 30 08:58:58 EDT 2011


Author: nfilotto
Date: 2011-08-30 08:58:58 -0400 (Tue, 30 Aug 2011)
New Revision: 4809

Modified:
   kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java
Log:
EXOJCR-1499: Collision between cache regions on a cluster using several portal containers

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2011-08-30 12:48:10 UTC (rev 4808)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2011-08-30 12:58:58 UTC (rev 4809)
@@ -95,6 +95,11 @@
    private final boolean allowShareableCache;
 
    /**
+    * The current {@link ExoContainerContext}
+    */
+   private final ExoContainerContext ctx;
+   
+   /**
     * The mapping between the configuration types and the creators
     */
    private final Map<Class<? extends ExoCacheConfig>, ExoCacheCreator> mappingConfigTypeCreators =
@@ -126,14 +131,15 @@
     */
    private final ExoCacheCreator defaultCreator = new FIFOExoCacheCreator();
 
-   public ExoCacheFactoryImpl(InitParams params, ConfigurationManager configManager)
+   public ExoCacheFactoryImpl(ExoContainerContext ctx, InitParams params, ConfigurationManager configManager)
    {
-      this(getValueParam(params, CACHE_CONFIG_TEMPLATE_KEY), configManager, getBooleanParam(params,
+      this(ctx, getValueParam(params, CACHE_CONFIG_TEMPLATE_KEY), configManager, getBooleanParam(params,
          ALLOW_SHAREABLE_CACHE, ALLOW_SHAREABLE_CACHE_DEFAULT));
    }
 
-   ExoCacheFactoryImpl(String cacheConfigTemplate, ConfigurationManager configManager, boolean allowShareableCache)
+   ExoCacheFactoryImpl(ExoContainerContext ctx, String cacheConfigTemplate, ConfigurationManager configManager, boolean allowShareableCache)
    {
+      this.ctx = ctx;
       this.configManager = configManager;
       this.cacheConfigTemplate = cacheConfigTemplate;
       this.allowShareableCache = allowShareableCache;
@@ -363,11 +369,16 @@
          }
       }
       Configuration cfg = cache.getConfiguration();
+      // Rename the cluster name
+      String clusterName = cfg.getClusterName();
+      if (clusterName != null && (clusterName = clusterName.trim()).length() > 0)
+      {
+         cfg.setClusterName(clusterName + "-" + ctx.getName());
+      }
       if (!allowShareableCache)
       {
          // Rename the cluster name
-         String clusterName = cfg.getClusterName();
-         if (clusterName != null && (clusterName = clusterName.trim()).length() > 0)
+         if (clusterName != null)
          {
             cfg.setClusterName(clusterName + "-" + region);
          }

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java	2011-08-30 12:48:10 UTC (rev 4808)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java	2011-08-30 12:58:58 UTC (rev 4809)
@@ -240,7 +240,7 @@
    {
       PortalContainer pc = PortalContainer.getInstance();
       ExoCacheFactoryImpl factory =
-         new ExoCacheFactoryImpl("jar:/conf/portal/cache-configuration-template.xml", (ConfigurationManager)pc
+         new ExoCacheFactoryImpl(pc.getContext(), "jar:/conf/portal/cache-configuration-template.xml", (ConfigurationManager)pc
             .getComponentInstanceOfType(ConfigurationManager.class), Boolean.valueOf(
             System.getProperty("allow.shareable.cache")).booleanValue());
       InitParams params = new InitParams();



More information about the exo-jcr-commits mailing list