Hi,

When using the minerva XA wrapper, I had some deadlock
problems after rolling back transactions. The database
connections of the transaction was not rolled back.

The org.jboss.minerva.xa.XAResourceImpl.rollback()
method was never called, and the patch below fixes
this.

BTW: Is the org.jboss.tm.TxCapcule class supposed
to be thread-safe?


Best Regards,

Ole Husgaard.
-----------------------------------------------------------
diff -ur jboss-cvs20000831/src/main/org/jboss/tm/TxCapsule.java 
jboss/src/main/org/jboss/tm/TxCapsule.java
--- jboss-cvs20000831/src/main/org/jboss/tm/TxCapsule.java      Fri Aug 18 05:21:12 
2000
+++ jboss/src/main/org/jboss/tm/TxCapsule.java  Thu Aug 31 17:30:13 2000
@@ -164,22 +164,7 @@
       if (status == Status.STATUS_MARKED_ROLLBACK)
       {
          // Rollback XAResources
-         status = Status.STATUS_ROLLING_BACK;
-         for (int i = 0; i < resources.size(); i++)
-         {
-
-            try
-            {
-               ((XAResource)resources.elementAt(i)).rollback(xid);
-            } catch (XAException e)
-            {
-               try {
-                  ((XAResource)resources.elementAt(i)).forget(xid);
-               } catch(XAException another) {}
-               // TODO: what to do here?
-            }
-         }
-         status = Status.STATUS_ROLLEDBACK;
+         rollbackResources();
       }
 
       // Call Synchronization
@@ -240,8 +225,8 @@
    {
       if (status == Status.STATUS_NO_TRANSACTION)
          throw new IllegalStateException("No transaction started");
-                
-                //MF FIXME I don't get it what is the use of this call if the 
"rollback is done in the commit
+
+      rollbackResources();
    }
 
    public void setRollbackOnly()
@@ -283,6 +268,25 @@
     }
 
    // Private -------------------------------------------------------
+   private void rollbackResources()
+   {
+      status = Status.STATUS_ROLLING_BACK;
+      for (int i = 0; i < resources.size(); i++)
+      {
+         try
+         {
+            ((XAResource)resources.elementAt(i)).rollback(xid);
+         } catch (XAException e)
+         {
+            try {
+               ((XAResource)resources.elementAt(i)).forget(xid);
+            } catch(XAException another) {}
+            // TODO: what to do here?
+         }
+      }
+      status = Status.STATUS_ROLLEDBACK;
+   }
+
 /*   private Object writeReplace(java.io.ObjectOutputStream out)
       throws IOException
    {

Reply via email to