activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1370576 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java
Date Tue, 07 Aug 2012 22:28:26 GMT
Author: tabish
Date: Tue Aug  7 22:28:26 2012
New Revision: 1370576

URL: http://svn.apache.org/viewvc?rev=1370576&view=rev
Log:
Test can leave a dangling BrokerSerive instance running if it get an assertion at the right
time.  Make sure all started brokers get stopped. 

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java?rev=1370576&r1=1370575&r2=1370576&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUpdateURIsTest.java
Tue Aug  7 22:28:26 2012
@@ -19,13 +19,16 @@ package org.apache.activemq.transport.fa
 import java.io.File;
 import java.io.FileOutputStream;
 import java.util.concurrent.TimeUnit;
+
 import javax.jms.Connection;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
+
 import junit.framework.TestCase;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnector;
@@ -40,12 +43,16 @@ public class FailoverUpdateURIsTest exte
     String firstTcpUri = "tcp://localhost:61616";
     String secondTcpUri = "tcp://localhost:61626";
     Connection connection = null;
+    BrokerService bs1 = null;
     BrokerService bs2 = null;
 
     public void tearDown() throws Exception {
         if (connection != null) {
             connection.close();
         }
+        if (bs1 != null) {
+            bs1.stop();
+        }
         if (bs2 != null) {
             bs2.stop();
         }
@@ -64,7 +71,7 @@ public class FailoverUpdateURIsTest exte
         out.write(firstTcpUri.getBytes());
         out.close();
 
-        BrokerService bs1 = createBroker("bs1", firstTcpUri);
+        bs1 = createBroker("bs1", firstTcpUri);
         bs1.start();
 
         // no failover uri's to start with, must be read from file...
@@ -82,6 +89,7 @@ public class FailoverUpdateURIsTest exte
 
         bs1.stop();
         bs1.waitUntilStopped();
+        bs1 = null;
 
         bs2 = createBroker("bs2", secondTcpUri);
         bs2.start();
@@ -108,7 +116,7 @@ public class FailoverUpdateURIsTest exte
 
     public void testAutoUpdateURIs() throws Exception {
 
-        BrokerService bs1 = new BrokerService();
+        bs1 = new BrokerService();
         bs1.setUseJmx(false);
         TransportConnector transportConnector = bs1.addConnector(firstTcpUri);
         transportConnector.setUpdateClusterClients(true);
@@ -138,6 +146,7 @@ public class FailoverUpdateURIsTest exte
         LOG.info("stopping brokerService 1");
         bs1.stop();
         bs1.waitUntilStopped();
+        bs1 = null;
 
         producer.send(message);
         msg = consumer.receive(4000);



Mime
View raw message