mirror of https://github.com/apache/activemq.git
ensure test is more deterministic and does not hang ci build
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1332977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
937c1e8cbc
commit
3307d57528
|
@ -32,6 +32,7 @@ public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
public void testTempQueueClosing() {
|
public void testTempQueueClosing() {
|
||||||
try {
|
try {
|
||||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(this.bindAddress);
|
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(this.bindAddress);
|
||||||
|
connectionFactory.setAlwaysSyncSend(true);
|
||||||
|
|
||||||
// First create session that will own the TempQueue
|
// First create session that will own the TempQueue
|
||||||
Connection connectionA = connectionFactory.createConnection();
|
Connection connectionA = connectionFactory.createConnection();
|
||||||
|
@ -56,13 +57,13 @@ public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
Thread sendingThread = new Thread(new Runnable() {
|
Thread sendingThread = new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < 100000; i++) {
|
long end = System.currentTimeMillis() + 5*60*1000;
|
||||||
|
// wait for exception on send
|
||||||
|
while (System.currentTimeMillis() < end) {
|
||||||
producerB.send(message);
|
producerB.send(message);
|
||||||
}
|
}
|
||||||
} catch (JMSException e) {
|
} catch (JMSException e) {
|
||||||
// We don't get this exception every time.
|
e.printStackTrace();
|
||||||
// Not getting it means that we don't know if the
|
|
||||||
// creator of the TempQueue has disconnected.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -72,7 +73,7 @@ public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
// Now close connection A. This will remove the TempQueue.
|
// Now close connection A. This will remove the TempQueue.
|
||||||
connectionA.close();
|
connectionA.close();
|
||||||
// Wait for the thread to finish.
|
// Wait for the thread to finish.
|
||||||
sendingThread.join();
|
sendingThread.join(5*60*1000);
|
||||||
|
|
||||||
// Sleep for a while to make sure that we should know that the
|
// Sleep for a while to make sure that we should know that the
|
||||||
// TempQueue is gone.
|
// TempQueue is gone.
|
||||||
|
@ -95,6 +96,7 @@ public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
bindAddress = "vm://localhost";
|
bindAddress = "vm://localhost";
|
||||||
|
setAutoFail(true);
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +105,6 @@ public class AMQ2571Test extends EmbeddedBrokerTestSupport {
|
||||||
BrokerService answer = new BrokerService();
|
BrokerService answer = new BrokerService();
|
||||||
answer.setPersistent(false);
|
answer.setPersistent(false);
|
||||||
answer.setUseJmx(false);
|
answer.setUseJmx(false);
|
||||||
answer.addConnector(bindAddress);
|
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1610,7 +1610,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
||||||
}
|
}
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
executorService.awaitTermination(10, TimeUnit.MINUTES);
|
executorService.awaitTermination(10, TimeUnit.MINUTES);
|
||||||
assertTrue("No exceptions", exceptions.isEmpty());
|
assertTrue("No exceptions " + exceptions.elements(), exceptions.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Listener implements MessageListener {
|
public static class Listener implements MessageListener {
|
||||||
|
@ -1649,6 +1649,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (JMSException e) {
|
catch (JMSException e) {
|
||||||
|
e.printStackTrace();
|
||||||
exceptions.add(e);
|
exceptions.add(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue