resolve https://issues.apache.org/activemq/browse/AMQ-2346 - TransactionContext XA state needs to be static to be shared across XAResource views

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@811003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2009-09-03 15:54:53 +00:00
parent 26eb49f259
commit d88004fe5d
3 changed files with 9 additions and 3 deletions

View File

@ -1435,7 +1435,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
if (isConnectionInfoSentToBroker) {
if (!transportFailed.get() && !closing.get()) {
asyncSendPacket(info.createRemoveCommand());
syncSendPacket(info.createRemoveCommand());
}
isConnectionInfoSentToBroker = false;
}

View File

@ -64,7 +64,7 @@ public class TransactionContext implements XAResource {
private static final Log LOG = LogFactory.getLog(TransactionContext.class);
// XATransactionId -> ArrayList of TransactionContext objects
private final ConcurrentHashMap<TransactionId, List<TransactionContext>> ENDED_XA_TRANSACTION_CONTEXTS = new ConcurrentHashMap<TransactionId, List<TransactionContext>>();
private final static ConcurrentHashMap<TransactionId, List<TransactionContext>> ENDED_XA_TRANSACTION_CONTEXTS = new ConcurrentHashMap<TransactionId, List<TransactionContext>>();
private final ActiveMQConnection connection;
private final LongSequenceGenerator localTransactionIdGenerator;

View File

@ -63,8 +63,14 @@ public class JmsXARollback2CxTransactionTest extends JmsQueueTransactionTest {
return (ConnectionFactory) managedConnectionFactory.createConnectionFactory(connectionManager);
}
public void xtestRepeatReceiveTwoThenRollback() throws Exception {
public void testReconnectWithClientId() throws Exception {
for (index = 0; index< 20; index ++) {
reconnect();
}
}
public void testRepeatReceiveTwoThenRollback() throws Exception {
for (index = 0; index< 2; index ++) {
testReceiveTwoThenRollback();
}
}