[exo-jcr-commits] exo-jcr SVN: r715 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 17 07:39:36 EST 2009


Author: pnedonosko
Date: 2009-11-17 07:39:35 -0500 (Tue, 17 Nov 2009)
New Revision: 715

Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: JDBC loader TX support (fixes)

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java	2009-11-17 12:26:25 UTC (rev 714)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java	2009-11-17 12:39:35 UTC (rev 715)
@@ -506,29 +506,27 @@
     */
    public void prepare(Object tx, List<Modification> modifications, boolean onePhase) throws Exception
    {
-
-      final WorkspaceStorageConnection exconn = transactions.remove(tx);
-      if (exconn != null)
-      {
-         apply(exconn, modifications);
-      }
-      else
-      {
-         final WorkspaceStorageConnection conn = dataContainer.openConnection();
-         apply(exconn, modifications);
-         transactions.put(tx, conn);
-      }
-
-      final WorkspaceStorageConnection conn = dataContainer.openConnection();
-      apply(conn, modifications);
-
       if (onePhase)
       {
+         final WorkspaceStorageConnection conn = dataContainer.openConnection();
+         apply(conn, modifications);
          conn.commit();
       }
       else
       {
-         transactions.put(tx, conn);
+         final WorkspaceStorageConnection exconn = transactions.remove(tx);
+         if (exconn != null)
+         {
+            // apply in existed connection associated with tx
+            apply(exconn, modifications);
+         }
+         else
+         {
+            // open new tx conn, apply in it, save the conn
+            final WorkspaceStorageConnection conn = dataContainer.openConnection();
+            apply(conn, modifications);
+            transactions.put(tx, conn);
+         }
       }
    }
 



More information about the exo-jcr-commits mailing list