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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Sep 17 23:21:43 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-09-17 23:21:42 -0400 (Mon, 17 Sep 2007)
New Revision: 4476

Modified:
   core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
Log:
[JBCACHE-1175] Option to force call sync/async

Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java	2007-09-17 23:08:24 UTC (rev 4475)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java	2007-09-18 03:21:42 UTC (rev 4476)
@@ -57,6 +57,7 @@
    private Option option;
 
    private boolean forceAsyncReplication = false;
+   private boolean forceSyncReplication = false;
 
    /**
     * List<MethodCall> of modifications ({@link MethodCall}). They will be replicated on TX commit
@@ -286,17 +287,51 @@
    /**
     * Sets the value of the forceAsyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
     * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
-    * a transactional context.
+    * a transactional context. Also used by OptimisticReplicationInterceptor when dealing
+    * with {@link org.jboss.cache.config.Option#setForceAsynchronous(boolean)} in a 
+    * non-transactional context (i.e. with an implicit transaction).
     *
     * @param forceAsyncReplication value of forceAsyncReplication
     */
    public void setForceAsyncReplication(boolean forceAsyncReplication)
    {
       this.forceAsyncReplication = forceAsyncReplication;
+      if (forceAsyncReplication)
+      {
+         forceSyncReplication = false;
+      }
    }
 
+   /**
+    * Gets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context.
+    *
+    * @return true if the forceAsyncReplication flag is set to true.
+    */
+   public boolean isForceSyncReplication()
+   {
+      return forceSyncReplication;
+   }
 
    /**
+    * Sets the value of the forceSyncReplication flag.  Used by ReplicationInterceptor and OptimisticReplicationInterceptor
+    * when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
+    * a transactional context.
+    *
+    * @param forceAsyncReplication value of forceAsyncReplication
+    */
+   public void setForceSyncReplication(boolean forceSyncReplication)
+   {
+      this.forceSyncReplication = forceSyncReplication;
+      if (forceSyncReplication)
+      {
+         forceAsyncReplication = false;
+      }
+   }
+
+
+   /**
     * Posts all undo operations to the CacheImpl.
     */
    public void undoOperations(CacheSPI cache)




More information about the jbosscache-commits mailing list