activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r923694 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java
Date Tue, 16 Mar 2010 11:12:37 GMT
Author: dejanb
Date: Tue Mar 16 11:12:37 2010
New Revision: 923694

URL: http://svn.apache.org/viewvc?rev=923694&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2594 - synchronizing transaction store commit
and triggering afterCommit event

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java?rev=923694&r1=923693&r2=923694&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transaction/LocalTransaction.java
Tue Mar 16 11:12:37 2010
@@ -67,18 +67,20 @@ public class LocalTransaction extends Tr
 
         setState(Transaction.FINISHED_STATE);
         context.getTransactions().remove(xid);
-        transactionStore.commit(getTransactionId(), false);
+        synchronized (transactionStore) {
+            transactionStore.commit(getTransactionId(), false);
 
-        try {
-            fireAfterCommit();
-        } catch (Throwable e) {
-            // I guess this could happen. Post commit task failed
-            // to execute properly.
-            LOG.warn("POST COMMIT FAILED: ", e);
-            XAException xae = new XAException("POST COMMIT FAILED");
-            xae.errorCode = XAException.XAER_RMERR;
-            xae.initCause(e);
-            throw xae;
+            try {
+                fireAfterCommit();
+            } catch (Throwable e) {
+                // I guess this could happen. Post commit task failed
+                // to execute properly.
+                LOG.warn("POST COMMIT FAILED: ", e);
+                XAException xae = new XAException("POST COMMIT FAILED");
+                xae.errorCode = XAException.XAER_RMERR;
+                xae.initCause(e);
+                throw xae;
+            }
         }
     }
 
@@ -90,16 +92,18 @@ public class LocalTransaction extends Tr
         }
         setState(Transaction.FINISHED_STATE);
         context.getTransactions().remove(xid);
-        transactionStore.rollback(getTransactionId());
+        synchronized (transactionStore) {
+           transactionStore.rollback(getTransactionId());
 
-        try {
-            fireAfterRollback();
-        } catch (Throwable e) {
-            LOG.warn("POST ROLLBACK FAILED: ", e);
-            XAException xae = new XAException("POST ROLLBACK FAILED");
-            xae.errorCode = XAException.XAER_RMERR;
-            xae.initCause(e);
-            throw xae;
+            try {
+                fireAfterRollback();
+            } catch (Throwable e) {
+                LOG.warn("POST ROLLBACK FAILED: ", e);
+                XAException xae = new XAException("POST ROLLBACK FAILED");
+                xae.errorCode = XAException.XAER_RMERR;
+                xae.initCause(e);
+                throw xae;
+            }
         }
     }
 



Mime
View raw message