activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r995397 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
Date Thu, 09 Sep 2010 12:26:05 GMT
Author: gtully
Date: Thu Sep  9 12:26:05 2010
New Revision: 995397

URL: http://svn.apache.org/viewvc?rev=995397&view=rev
Log:
follow up on comment to https://issues.apache.org/activemq/browse/AMQ-2556 - ensure ended
tx are removed in the event that prepare results in an exception

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java?rev=995397&r1=995396&r2=995397&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java
Thu Sep  9 12:26:05 2010
@@ -441,6 +441,19 @@ public class TransactionContext implemen
             return response.getResult();
 
         } catch (JMSException e) {
+            LOG.warn("prepare of: " + x + " failed with: " + e, e);
+            List<TransactionContext> l = ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
+            if (l != null && !l.isEmpty()) {
+                for (TransactionContext ctx : l) {
+                    try {
+                        ctx.afterRollback();
+                    } catch (Throwable ignored) {
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("failed to firing afterRollback callbacks on prepare
failure, txid: " + x + ", context: " + ctx, ignored);
+                        }
+                    }
+                }
+            }
             throw toXAException(e);
         }
     }



Mime
View raw message