[exo-jcr-commits] exo-jcr SVN: r996 - 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
Thu Dec 10 15:05:36 EST 2009


Author: nfilotto
Date: 2009-12-10 15:05:35 -0500 (Thu, 10 Dec 2009)
New Revision: 996

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-296: Apply some remarks after the work done for KER-119
Fix issues related to KER-125

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	2009-12-10 17:08:23 UTC (rev 995)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2009-12-10 20:05:35 UTC (rev 996)
@@ -18,12 +18,6 @@
  */
 package org.exoplatform.services.cache.impl.jboss;
 
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.container.xml.InitParams;
 import org.exoplatform.container.xml.ValueParam;
@@ -42,6 +36,12 @@
 import org.jboss.cache.config.EvictionRegionConfig;
 import org.jboss.cache.config.Configuration.CacheMode;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
 /**
  * This class is the JBoss Cache implementation of the {@link org.exoplatform.services.cache.ExoCacheFactory}
  * Created by The eXo Platform SAS
@@ -112,13 +112,13 @@
     * 2. If no specific location has been defined, we use the default configuration which is
     * "${CACHE_CONFIG_TEMPLATE_KEY}"
     */
-   public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException
+   public ExoCache<Serializable, Object> createCache(ExoCacheConfig config) throws ExoCacheInitException
    {
       final String region = config.getName();
       final String customConfig = mappingCacheNameConfig.get(region);
       final Cache<Serializable, Object> cache;
       final CacheFactory<Serializable, Object> factory = new DefaultCacheFactory<Serializable, Object>();
-      final ExoCache eXoCache;
+      final ExoCache<Serializable, Object> eXoCache;
       try
       {
          if (customConfig != null)
@@ -230,7 +230,13 @@
    {
       final Configuration config = cache.getConfiguration();
       // Reset the eviction policies 
-      final EvictionConfig evictionConfig = config.getEvictionConfig();
+      EvictionConfig evictionConfig = config.getEvictionConfig();
+      if (evictionConfig == null)
+      {
+         // If not eviction config exists, we create an empty one
+         evictionConfig = new EvictionConfig();
+         config.setEvictionConfig(evictionConfig);
+      }
       evictionConfig.setEvictionRegionConfigs(new LinkedList<EvictionRegionConfig>());
       // Rename the cluster name
       String clusterName = config.getClusterName();

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	2009-12-10 17:08:23 UTC (rev 995)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/test/java/org/exoplatform/services/cache/impl/jboss/TestAbstractExoCache.java	2009-12-10 20:05:35 UTC (rev 996)
@@ -232,6 +232,7 @@
    @SuppressWarnings("unchecked")
    public void testDistributedCache() throws Exception
    {
+      System.out.println("WARNING: For Linux distributions the following JVM parameter must be set to true, java.net.preferIPv4Stack = " + System.getProperty("java.net.preferIPv4Stack"));
       ExoCacheConfig config = new ExoCacheConfig();
       config.setName("MyCacheDistributed");
       config.setMaxSize(5);
@@ -404,7 +405,7 @@
       long time = System.currentTimeMillis();
       final ExoCache<Serializable, Object> cache = service.getCacheInstance("test-multi-threading");
       final int totalElement = 100;
-      final int totalTimes = 100;
+      final int totalTimes = 20;
       int reader = 20;
       int writer = 10;
       int remover = 5;



More information about the exo-jcr-commits mailing list