mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@673433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3f4d4a5f7a
commit
4118d02a95
|
@ -941,7 +941,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
|
|||
|
||||
try {
|
||||
transport.stop();
|
||||
LOG.debug("Stopped connection: " + transport.getRemoteAddress());
|
||||
LOG.debug("Stopped transport: " + transport.getRemoteAddress());
|
||||
} catch (Exception e) {
|
||||
LOG.debug("Could not stop transport: " + e, e);
|
||||
}
|
||||
|
|
|
@ -383,6 +383,8 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
|
|||
ConnectionState cs = connectionStates.get(connectionId);
|
||||
if (cs != null) {
|
||||
cs.addTransactionState(info.getTransactionId());
|
||||
TransactionState state = cs.getTransactionState(info.getTransactionId());
|
||||
state.addCommand(info);
|
||||
}
|
||||
}
|
||||
return TRACKED_RESPONSE_MARKER;
|
||||
|
|
|
@ -131,7 +131,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
|
|||
for (int i = 0; i < batchSize; i++) {
|
||||
producer.send(message);
|
||||
}
|
||||
|
||||
messageSent();
|
||||
session.commit();
|
||||
LOG.info("Consuming bacth " + j + " of " + batchSize + " messages");
|
||||
|
||||
|
@ -145,6 +145,9 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
|
|||
}
|
||||
}
|
||||
|
||||
protected void messageSent() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a batch of messages and validates that the rollbacked message was
|
||||
* not consumed.
|
||||
|
|
|
@ -30,6 +30,7 @@ public class TransactedTopicMasterSlaveTest extends JmsTopicTransactionTest {
|
|||
protected int inflightMessageCount;
|
||||
protected int failureCount = 50;
|
||||
protected String uriString = "failover://(tcp://localhost:62001,tcp://localhost:62002)?randomize=false";
|
||||
private boolean stopMaster = false;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
failureCount = super.batchCount / 2;
|
||||
|
@ -76,8 +77,17 @@ public class TransactedTopicMasterSlaveTest extends JmsTopicTransactionTest {
|
|||
return new ActiveMQConnectionFactory(uriString);
|
||||
}
|
||||
|
||||
protected void messageSent() throws Exception {
|
||||
public void testSendReceiveTransactedBatchesWithMasterStop() throws Exception {
|
||||
try {
|
||||
stopMaster = true;
|
||||
testSendReceiveTransactedBatches();
|
||||
} finally {
|
||||
stopMaster = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void messageSent() throws Exception {
|
||||
if (stopMaster) {
|
||||
if (++inflightMessageCount >= failureCount) {
|
||||
inflightMessageCount = 0;
|
||||
Thread.sleep(1000);
|
||||
|
@ -85,3 +95,4 @@ public class TransactedTopicMasterSlaveTest extends JmsTopicTransactionTest {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue