diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/TransactionBroker.java b/activemq-broker/src/main/java/org/apache/activemq/broker/TransactionBroker.java index caea29fb27..33426de551 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/TransactionBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/TransactionBroker.java @@ -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; }