[jboss-cvs] JBossAS SVN: r105145 - in projects/cluster/ha-server-cache-jbc/trunk: src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 24 09:56:42 EDT 2010


Author: pferraro
Date: 2010-05-24 09:56:41 -0400 (Mon, 24 May 2010)
New Revision: 105145

Modified:
   projects/cluster/ha-server-cache-jbc/trunk/pom.xml
   projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
   projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/JBossCacheWrapper.java
Log:
[JBCLUSTER-273] Add setForceSynchronous(...) to DistributedCacheManager

Modified: projects/cluster/ha-server-cache-jbc/trunk/pom.xml
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/pom.xml	2010-05-24 13:50:38 UTC (rev 105144)
+++ projects/cluster/ha-server-cache-jbc/trunk/pom.xml	2010-05-24 13:56:41 UTC (rev 105145)
@@ -30,7 +30,7 @@
   </scm>
   
   <properties>
-    <version.jboss.ha.server.cache.spi>2.1.0.Final</version.jboss.ha.server.cache.spi>
+    <version.jboss.ha.server.cache.spi>2.1.1-SNAPSHOT</version.jboss.ha.server.cache.spi>
     <version.jboss.ha.server.api>2.0.0.Alpha3</version.jboss.ha.server.api>
     <version.jboss.common.core>2.2.17.GA</version.jboss.common.core>
     <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>

Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java	2010-05-24 13:50:38 UTC (rev 105144)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/AbstractJBossCacheService.java	2010-05-24 13:56:41 UTC (rev 105145)
@@ -718,6 +718,11 @@
       return usePassivation_;      
    }
 
+   public void setForceSynchronous(boolean forceSynchronous)
+   {
+      this.cacheWrapper_.setForceSynchronous(forceSynchronous);
+   }
+
    protected Fqn<String> getWebappFqn()
    {
       // /SESSION/webAppPath_hostName

Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/JBossCacheWrapper.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/JBossCacheWrapper.java	2010-05-24 13:50:38 UTC (rev 105144)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/JBossCacheWrapper.java	2010-05-24 13:56:41 UTC (rev 105145)
@@ -21,7 +21,6 @@
 */
 package org.jboss.web.tomcat.service.session.distributedcache.impl.jbc;
 
-import java.util.Collections;
 import java.util.Map;
 import java.util.Random;
 
@@ -29,6 +28,7 @@
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.SuspectException;
+import org.jboss.cache.config.Option;
 import org.jboss.cache.lock.TimeoutException;
 
 public class JBossCacheWrapper 
@@ -40,6 +40,7 @@
    private static final int[] BACK_OFF_INTERVALS = { 10, 100 };
    private Cache<Object, Object> plainCache_;
    private final Random random = new Random(System.currentTimeMillis());
+   private volatile boolean forceSynchronous = false;
    
    JBossCacheWrapper(Cache<Object, Object> cache)
    {
@@ -52,12 +53,9 @@
       for (int i = 0; i < RETRY; i++)
       {
          try
-         {             
-            if (gravitate)
-            {            
-               plainCache_.getInvocationContext().getOptionOverrides()
-                                                 .setForceDataGravitation(true);
-            }
+         {
+            this.getOptionOverrides().setForceDataGravitation(gravitate);
+
             return plainCache_.getData(fqn);
          }
          catch (TimeoutException e)
@@ -102,12 +100,9 @@
       for (int i = 0; i < RETRY; i++)
       {
          try
-         {            
-            if (gravitate)
-            {            
-               plainCache_.getInvocationContext().getOptionOverrides()
-                                                 .setForceDataGravitation(true);
-            }
+         {
+            this.getOptionOverrides().setForceDataGravitation(gravitate);
+
             return plainCache_.get(fqn, id);
          }
          catch (TimeoutException e)
@@ -143,6 +138,7 @@
       {
          try
          {
+            this.getOptionOverrides();
             plainCache_.put(fqn, id, value);
             return;
          }
@@ -178,6 +174,7 @@
       {
          try
          {
+            this.getOptionOverrides();
             plainCache_.put(fqn, map);
             return;
          }
@@ -213,6 +210,7 @@
       {
          try
          {
+            this.getOptionOverrides();
             return plainCache_.remove(fqn, id);
          }
          catch (TimeoutException e)
@@ -247,8 +245,8 @@
       {
          try
          {
-            plainCache_.getInvocationContext().getOptionOverrides()
-                                              .setCacheModeLocal(true);
+            this.getOptionOverrides().setCacheModeLocal(true);
+
             return plainCache_.remove(fqn, id);
          }
          catch (TimeoutException e)
@@ -277,6 +275,7 @@
       {
          try
          {
+            this.getOptionOverrides();
             plainCache_.removeNode(fqn);
             return;
          }
@@ -310,8 +309,8 @@
       {
          try
          {
-            plainCache_.getInvocationContext().getOptionOverrides()
-                                              .setCacheModeLocal(true);
+            this.getOptionOverrides().setCacheModeLocal(true);
+
             plainCache_.removeNode(fqn);
             return;
          }
@@ -336,6 +335,7 @@
       {
          try
          {
+            this.getOptionOverrides();
             plainCache_.evict(fqn, true);
             return;
             
@@ -354,6 +354,11 @@
       throw new RuntimeException(RETRY_FAIL_MSG, ex);
    }
    
+   void setForceSynchronous(boolean forceSynchronous)
+   {
+      this.forceSynchronous = forceSynchronous;
+   }
+   
    /**
     * Causes the calling thread to sleep a random amount of time up to
     * BACK_OFF_INTERVALS[attempt].
@@ -380,4 +385,11 @@
       }
       return true;
    }
+   
+   private Option getOptionOverrides()
+   {
+      Option option = this.plainCache_.getInvocationContext().getOptionOverrides();
+      option.setForceSynchronous(this.forceSynchronous);
+      return option;
+   }
 }




More information about the jboss-cvs-commits mailing list