[hornetq-commits] JBoss hornetq SVN: r11128 - branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Aug 4 22:36:17 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-08-04 22:36:17 -0400 (Thu, 04 Aug 2011)
New Revision: 11128

Modified:
   branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/MessageSender.java
   branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/SpringIntegrationTest.java
Log:
fixing thread leakage on test

Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/MessageSender.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/MessageSender.java	2011-08-05 00:56:43 UTC (rev 11127)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/MessageSender.java	2011-08-05 02:36:17 UTC (rev 11128)
@@ -47,6 +47,7 @@
          MessageProducer producer = session.createProducer(destination);
          TextMessage message = session.createTextMessage(msg);
          producer.send(message);
+         conn.close();
       }
       catch (Exception ex)
       {

Modified: branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/SpringIntegrationTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/SpringIntegrationTest.java	2011-08-05 00:56:43 UTC (rev 11127)
+++ branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/spring/SpringIntegrationTest.java	2011-08-05 02:36:17 UTC (rev 11128)
@@ -2,10 +2,12 @@
 
 import junit.framework.Assert;
 
+import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.server.embedded.EmbeddedJMS;
 import org.hornetq.tests.util.UnitTestCase;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
 /**
  * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
@@ -24,11 +26,21 @@
          sender.send("Hello world");
          Thread.sleep(100);
          Assert.assertEquals(ExampleListener.lastMessage, "Hello world");
+         ((HornetQConnectionFactory)sender.getConnectionFactory()).close();
       }
       finally
       {
          try
          {
+            DefaultMessageListenerContainer container = (DefaultMessageListenerContainer)context.getBean("listenerContainer");
+            container.stop();
+         }
+         catch (Throwable ignored)
+         {
+            ignored.printStackTrace();
+         }
+         try
+         {
             EmbeddedJMS jms = (EmbeddedJMS)context.getBean("EmbeddedJms");
             jms.stop();
          }



More information about the hornetq-commits mailing list