geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1028958 - in /geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager: CommitTask.java RollbackTask.java
Date Sat, 30 Oct 2010 00:31:41 GMT
Author: djencks
Date: Sat Oct 30 00:31:41 2010
New Revision: 1028958

URL: http://svn.apache.org/viewvc?rev=1028958&view=rev
Log:
GERONIMO-5648 fix some errors in RollbackTask shown by osgi tx tests

Modified:
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RollbackTask.java

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java?rev=1028958&r1=1028957&r2=1028958&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/CommitTask.java
Sat Oct 30 00:31:41 2010
@@ -90,7 +90,7 @@ public class CommitTask implements Runna
                     } else if (e.errorCode == XAException.XAER_RMFAIL) {
                         //refresh the xa resource from the NamedXAResourceFactory
                         if (manager.getCommitter() instanceof NamedXAResource) {
-                            String xaResourceName = ((NamedXAResource)manager.getCommitter()).getName();
+                            String xaResourceName = manager.getResourceName();
                             NamedXAResourceFactory namedXAResourceFactory = txManager.getNamedXAResourceFactory(xaResourceName);
                             if (namedXAResourceFactory != null) {
                                 try {

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RollbackTask.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RollbackTask.java?rev=1028958&r1=1028957&r2=1028958&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RollbackTask.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RollbackTask.java
Sat Oct 30 00:31:41 2010
@@ -52,6 +52,7 @@ public class RollbackTask implements Run
         this.txManager = txManager;
     }
 
+    @Override
     public void run() {
         synchronized (this) {
             status = Status.STATUS_ROLLING_BACK;
@@ -66,7 +67,10 @@ public class RollbackTask implements Run
                 } catch (XAException e) {
                     log.error("Unexpected exception committing " + manager.getCommitter()
+ "; continuing to commit other RMs", e);
 
-                    if (e.errorCode == XAException.XA_HEURRB) {
+                    if (e.errorCode >= XAException.XA_RBBASE && e.errorCode <=
XAException.XA_RBEND || e.errorCode == XAException.XAER_NOTA) {
+                        remove(index);
+                        everRolledBack = true;
+                    } else if (e.errorCode == XAException.XA_HEURRB) {
                         remove(index);
                         // let's not throw an exception as the transaction has been rolled
back
                         log.info("Transaction has been heuristically rolled back");
@@ -86,10 +90,10 @@ public class RollbackTask implements Run
                     } else if (e.errorCode == XAException.XA_RETRY) {
                         // do nothing, retry later
                         index++;
-                    } else if (e.errorCode == XAException.XAER_RMFAIL) {
+                    } else if (e.errorCode == XAException.XAER_RMFAIL || e.errorCode == XAException.XAER_RMERR)
{
                         //refresh the xa resource from the NamedXAResourceFactory
                         if (manager.getCommitter() instanceof NamedXAResource) {
-                            String xaResourceName = ((NamedXAResource)manager.getCommitter()).getName();
+                            String xaResourceName = manager.getResourceName();
                             NamedXAResourceFactory namedXAResourceFactory = txManager.getNamedXAResourceFactory(xaResourceName);
                             if (namedXAResourceFactory != null) {
                                 try {
@@ -106,15 +110,10 @@ public class RollbackTask implements Run
                                 index++;
                             }
                         } else {
-                            //no hope
+                            //no hope.  Since we don't record the exception if we do manage
to retry stuff later, presumably we shouldn't now, either.
                             remove(index);
-                            cause = e;
                         }
                     } else {
-                        //at least these error codes:
-                        // XAException.XA_RMERR
-                        // XAException.XA_RBROLLBACK
-                        // XAException.XAER_NOTA
                         //nothing we can do about it
                         remove(index);
                         cause = e;



Mime
View raw message