Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 77494 invoked from network); 16 Mar 2010 11:13:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Mar 2010 11:13:02 -0000 Received: (qmail 75962 invoked by uid 500); 16 Mar 2010 11:13:02 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 75899 invoked by uid 500); 16 Mar 2010 11:13:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 75888 invoked by uid 99); 16 Mar 2010 11:13:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Mar 2010 11:13:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Mar 2010 11:12:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B7CE02388897; Tue, 16 Mar 2010 11:12:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: dejanb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100316111237.B7CE02388897@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; + } } }