[jbosscache-commits] JBoss Cache SVN: r4477 - core/trunk/src/main/java/org/jboss/cache/config.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Sep 17 23:22:49 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-09-17 23:22:49 -0400 (Mon, 17 Sep 2007)
New Revision: 4477

Modified:
   core/trunk/src/main/java/org/jboss/cache/config/Option.java
Log:
[JBCACHE-1175] Option to force call sync/async
[JBCACHE-1178] Option to set lock timeout

Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Option.java	2007-09-18 03:21:42 UTC (rev 4476)
+++ core/trunk/src/main/java/org/jboss/cache/config/Option.java	2007-09-18 03:22:49 UTC (rev 4477)
@@ -25,6 +25,11 @@
 
    private boolean forceWriteLock;
    private boolean skipCacheStatusCheck;
+   
+   private boolean forceAsynchronous;
+   private boolean forceSynchronous;
+   
+   private int lockAcquisitionTimeout = -1;
 
    /**
     * @since 1.4.0
@@ -144,7 +149,89 @@
       this.skipDataGravitation = skipDataGravitation;
    }
 
+   /**
+    * Gets whether replication or invalidation should be done asynchronously,
+    * even if the cache is configured in a synchronous mode.  Has no
+    * effect if the call is occuring within a transactional context.
+    * 
+    * @return <code>true</code> if replication/invalidation should be done
+    *         asynchronously; <code>false</code> if the default mode 
+    *         configured for the cache should be used.
+    */
+   public boolean isForceAsynchronous()
+   {
+      return forceAsynchronous;
+   }
 
+   /**
+    * Sets whether replication or invalidation should be done asynchronously,
+    * even if the cache is configured in a synchronous mode.  Has no
+    * effect if the call is occuring within a transactional context.
+    * 
+    * @param forceAsynchronous <code>true</code> if replication/invalidation 
+    *                          should be done asynchronously; <code>false</code>
+    *                          if the default mode configured for the cache 
+    *                          should be used.
+    */
+   public void setForceAsynchronous(boolean forceAsynchronous)
+   {
+      this.forceAsynchronous = forceAsynchronous;
+   }
+
+   /**
+    * Gets whether replication or invalidation should be done synchronously,
+    * even if the cache is configured in an asynchronous mode.  Has no
+    * effect if the call is occuring within a transactional context.
+    * 
+    * @return <code>true</code> if replication/invalidation should be done
+    *         synchronously; <code>false</code> if the default mode 
+    *         configured for the cache should be used.
+    */
+   public boolean isForceSynchronous()
+   {
+      return forceSynchronous;
+   }
+
+   /**
+    * Sets whether replication or invalidation should be done synchronously,
+    * even if the cache is configured in an asynchronous mode.  Has no
+    * effect if the call is occuring within a transactional context.
+    * 
+    * @param forceAsynchronous <code>true</code> if replication/invalidation 
+    *                          should be done synchronously; <code>false</code>
+    *                          if the default mode configured for the cache 
+    *                          should be used.
+    */
+   public void setForceSynchronous(boolean forceSynchronous)
+   {
+      this.forceSynchronous = forceSynchronous;
+   }
+
+   /**
+    * Gets any lock acquisition timeout configured for the call.
+    * 
+    * @return the time in ms that lock acquisition attempts should block
+    *         before failing with a TimeoutException.  A value < 0 indicates
+    *         that the cache's default timeout should be used.
+    */
+   public int getLockAcquisitionTimeout()
+   {
+      return lockAcquisitionTimeout;
+   }
+
+   /**
+    * Sets any lock acquisition timeout configured for the call.
+    * 
+    * @param lockAcquisitionTimeout the time in ms that lock acquisition 
+    *                               attempts should block before failing with a 
+    *                               TimeoutException.  A value < 0 indicates
+    *                               that the cache's default timeout should be used.
+    */
+   public void setLockAcquisitionTimeout(int lockAcquisitionTimeout)
+   {
+      this.lockAcquisitionTimeout = lockAcquisitionTimeout;
+   }
+
    public String toString()
    {
       return "Option{" +
@@ -152,8 +239,11 @@
               ", cacheModeLocal=" + cacheModeLocal +
               ", dataVersion=" + dataVersion +
               ", suppressLocking=" + suppressLocking +
+              ", lockAcquisitionTimeout=" + lockAcquisitionTimeout +
               ", forceDataGravitation=" + forceDataGravitation +
               ", skipDataGravitation=" + skipDataGravitation +
+              ", forceAsynchronous=" + forceAsynchronous +
+              ", forceSynchronous=" + forceSynchronous +
               '}';
    }
 
@@ -177,6 +267,9 @@
       if (suppressLocking != option.suppressLocking) return false;
       if (dataVersion != null ? !dataVersion.equals(option.dataVersion) : option.dataVersion != null) return false;
       if (forceWriteLock != option.forceWriteLock) return false;
+      if (forceAsynchronous != option.forceAsynchronous) return false;
+      if (forceSynchronous != option.forceSynchronous) return false;
+      if (lockAcquisitionTimeout != option.lockAcquisitionTimeout) return false;
       return true;
    }
 
@@ -190,6 +283,9 @@
       result = 29 * result + (forceDataGravitation ? 1 : 0);
       result = 29 * result + (skipDataGravitation ? 1 : 0);
       result = 29 * result + (forceWriteLock ? 0 : 1);
+      result = 29 * result + (forceAsynchronous ? 0 : 1);
+      result = 29 * result + (forceSynchronous ? 0 : 1);
+      result = 29 * result + (lockAcquisitionTimeout);
       return result;
    }
 
@@ -205,6 +301,9 @@
       this.suppressLocking = false;
       this.dataVersion = null;
       this.forceWriteLock = false;
+      this.forceAsynchronous = false;
+      this.forceSynchronous = false;
+      this.lockAcquisitionTimeout = -1;
    }
 
    /**




More information about the jbosscache-commits mailing list