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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Nov 5 14:01:32 EST 2008


Author: genman
Date: 2008-11-05 14:01:32 -0500 (Wed, 05 Nov 2008)
New Revision: 7087

Modified:
   core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
Log:
Related to JBCACHE-1438
Make one phase commit operation work the same as an async put

Modified: core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java	2008-11-05 18:39:35 UTC (rev 7086)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java	2008-11-05 19:01:32 UTC (rev 7087)
@@ -187,7 +187,46 @@
       return null;
    }
 
+   /**
+    * TODO this is the same as the AbstractCacheLoader.
+    */
    @Override
+   public void prepare(Object tx, List<Modification> modifications, boolean one_phase) throws Exception
+   {
+      if (one_phase)
+      {
+         put(modifications);
+      }
+      else
+      {
+         transactions.put(tx, modifications);
+      }
+   }
+
+   /**
+    * TODO this is the same as the AbstractCacheLoader.
+    */
+   @Override
+   public void commit(Object tx) throws Exception
+   {
+      List<Modification> modifications = transactions.remove(tx);
+      if (modifications == null)
+      {
+         throw new Exception("transaction " + tx + " not found in transaction table");
+      }
+      put(modifications);
+   }
+
+   /**
+    * TODO this is the same as the AbstractCacheLoader.
+    */
+   @Override
+   public void rollback(Object tx)
+   {
+      transactions.remove(tx);
+   }
+   
+   @Override
    public Object put(Fqn name, Object key, Object value) throws Exception
    {
       if (config.getUseAsyncPut())




More information about the jbosscache-commits mailing list