https://issues.apache.org/jira/browse/AMQ-5953 - transaction broker, fix sync of xatransaction get with insert

This commit is contained in:
gtully 2015-09-03 16:55:42 +01:00
parent 0f492f3b4b
commit c7b93d1232
1 changed files with 7 additions and 4 deletions

View File

@ -336,11 +336,14 @@ public class TransactionBroker extends BrokerFilter {
//
// ////////////////////////////////////////////////////////////////////////////
public Transaction getTransaction(ConnectionContext context, TransactionId xid, boolean mightBePrepared) throws JMSException, XAException {
Map transactionMap = null;
synchronized (xaTransactions) {
transactionMap = xid.isXATransaction() ? xaTransactions : context.getTransactions();
Transaction transaction = null;
if (xid.isXATransaction()) {
synchronized (xaTransactions) {
transaction = xaTransactions.get(xid);
}
} else {
transaction = context.getTransactions().get(xid);
}
Transaction transaction = (Transaction)transactionMap.get(xid);
if (transaction != null) {
return transaction;
}