You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2010/09/09 14:26:05 UTC

svn commit: r995397 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/TransactionContext.java

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);
         }
     }