ClientRebalanceTest - fix the test to avoid occasional hang

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1324799 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-04-11 15:03:03 +00:00
parent 0c2144c357
commit 7df5c3bdcc
4 changed files with 11 additions and 10 deletions

View File

@ -37,6 +37,7 @@ public class ClientRebalanceTest extends JmsMultipleBrokersTestSupport {
super.setUp(); super.setUp();
} }
public void testRebalance() throws Exception { public void testRebalance() throws Exception {
createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker1.xml")); createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker1.xml"));
createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker2.xml")); createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker2.xml"));
@ -62,15 +63,15 @@ public class ClientRebalanceTest extends JmsMultipleBrokersTestSupport {
// introduce third broker // introduce third broker
createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker3.xml")); createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker3.xml"));
brokers.get("b3").broker.waitUntilStarted(); brokers.get("b3").broker.waitUntilStarted();
Thread.sleep(1000); Thread.sleep(3000);
LOG.info("Stopping broker 1"); LOG.info("Stopping broker 1");
brokers.get("b1").broker.stop(); brokers.get("b1").broker.stop();
brokers.get("b1").broker.waitUntilStopped(); brokers.get("b1").broker.waitUntilStopped();
Thread.sleep(1000); Thread.sleep(3000);
// should reconnect to some of the remaining brokers // should reconnect to some of the remaining brokers
producer.send(message); producer.send(message);
msg = consumer.receive(2000); msg = consumer.receive(2000);

View File

@ -1,8 +1,8 @@
<beans xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd" xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <beans xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd" xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<broker brokerName="b1" persistent="false" useJmx="false" xmlns="http://activemq.apache.org/schema/core"> <broker brokerName="b1" persistent="false" useJmx="false" xmlns="http://activemq.apache.org/schema/core">
<networkConnectors> <networkConnectors>
<networkConnector name="b1_b2" uri="static://tcp://localhost:61617" duplex="false"/> <networkConnector name="b1_b2" uri="static:(tcp://localhost:61617)?useExponentialBackOff=false" duplex="false"/>
<networkConnector name="b1_b3" uri="static://tcp://localhost:61618"></networkConnector> <networkConnector name="b1_b3" uri="static:(tcp://localhost:61618)?useExponentialBackOff=false"></networkConnector>
</networkConnectors> </networkConnectors>
<!-- The transport connectors ActiveMQ will listen to --> <!-- The transport connectors ActiveMQ will listen to -->

View File

@ -2,8 +2,8 @@
<broker brokerName="b2" persistent="false" useJmx="false" xmlns="http://activemq.apache.org/schema/core"> <broker brokerName="b2" persistent="false" useJmx="false" xmlns="http://activemq.apache.org/schema/core">
<networkConnectors> <networkConnectors>
<networkConnector name="b2_b1" uri="static://tcp://localhost:61616" duplex="false"/> <networkConnector name="b2_b1" uri="static:(tcp://localhost:61616)?useExponentialBackOff=false" duplex="false"/>
<networkConnector name="b2_b3" uri="static://tcp://localhost:61618"></networkConnector> <networkConnector name="b2_b3" uri="static:(tcp://localhost:61618)?useExponentialBackOff=false"></networkConnector>
</networkConnectors> </networkConnectors>
<!-- The transport connectors ActiveMQ will listen to --> <!-- The transport connectors ActiveMQ will listen to -->

View File

@ -1,8 +1,8 @@
<beans xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd" xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <beans xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd" xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<broker brokerName="b3" persistent="false" useJmx="true" xmlns="http://activemq.apache.org/schema/core"> <broker brokerName="b3" persistent="false" useJmx="true" xmlns="http://activemq.apache.org/schema/core">
<networkConnectors> <networkConnectors>
<networkConnector name="b3_b1" uri="static://tcp://localhost:61616"></networkConnector> <networkConnector name="b3_b1" uri="static:(tcp://localhost:61616)?useExponentialBackOff=false"></networkConnector>
<networkConnector name="b3_b2" uri="static://tcp://localhost:61617"></networkConnector> <networkConnector name="b3_b2" uri="static:(tcp://localhost:61617)?useExponentialBackOff=false"></networkConnector>
</networkConnectors> </networkConnectors>
<!-- The transport connectors ActiveMQ will listen to --> <!-- The transport connectors ActiveMQ will listen to -->