jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r1074140 - in /jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca: JCAManagedConnection.java JCAManagedConnectionFactory.java TransactionBoundXAResource.java
Date Thu, 24 Feb 2011 13:35:38 GMT
Author: ckoell
Date: Thu Feb 24 13:35:38 2011
New Revision: 1074140

URL: http://svn.apache.org/viewvc?rev=1074140&view=rev
Log:
JCR-2901 the transaction handling in container managed environment is broken

Modified:
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java?rev=1074140&r1=1074139&r2=1074140&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnection.java
Thu Feb 24 13:35:38 2011
@@ -57,7 +57,7 @@ public final class JCAManagedConnection
     /**
      * XAResource instance.
      */
-    private final XAResource xaResource;
+    private XAResource xaResource;
 
     /**
      * Listeners.
@@ -156,8 +156,8 @@ public final class JCAManagedConnection
      */
     public void destroy()
             throws ResourceException {
-        cleanup();
-        session.logout();
+        this.session.logout();
+        this.handles.clear();
     }
 
     /**
@@ -170,6 +170,11 @@ public final class JCAManagedConnection
             this.session.logout();
             this.session = openSession();
             this.handles.clear();
+            if (this.mcf.getBindSessionToTransaction().booleanValue() && (this.xaResource
instanceof TransactionBoundXAResource)) {
+            	((TransactionBoundXAResource) this.xaResource).rebind((XAResource) session);
+            } else {
+            	this.xaResource = (XAResource) session;
+            }
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java?rev=1074140&r1=1074139&r2=1074140&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCAManagedConnectionFactory.java
Thu Feb 24 13:35:38 2011
@@ -45,7 +45,7 @@ public final class JCAManagedConnectionF
 
     /**
      * Flag indicating whether the session should be bound to the
-     * transaction lyfecyle.
+     * transaction lifecycle.
      * In other words, if this flag is true the handle
      * will be closed when the transaction ends.
      */

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java?rev=1074140&r1=1074139&r2=1074140&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/TransactionBoundXAResource.java
Thu Feb 24 13:35:38 2011
@@ -34,6 +34,16 @@ public class TransactionBoundXAResource 
         this.xaResource = xaResource;
         this.connection = connection;
     }
+    
+    /**
+     * There is a one-to-one Relation between this TransactionBoundXAResource
+     * and the JCAManagedConnection so the used XAResource must be in sync when it is changed
in the
+     * JCAManagedConnection.
+     * @param res
+     */
+    protected void rebind(XAResource res) {
+        this.xaResource = res;
+    }
 
     public void commit(Xid arg0, boolean arg1) throws XAException {
         xaResource.commit(arg0, arg1);



Mime
View raw message