[jboss-cvs] JBoss Messaging SVN: r5102 - branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 10 11:55:41 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-10-10 11:55:41 -0400 (Fri, 10 Oct 2008)
New Revision: 5102

Modified:
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
Log:
Closing consumer right after message received

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2008-10-10 15:22:52 UTC (rev 5101)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2008-10-10 15:55:41 UTC (rev 5102)
@@ -552,6 +552,11 @@
          TextMessage tm = (TextMessage)cons1.receive(1000);
          assertNotNull(tm);
          assertEquals("message 1", tm.getText());
+         
+         // a long running process should close its consumer to avoid message caching on the client
+         // This close can be removed when we change the distribution policy on slow consumers
+         cons1.close();
+         cons1 = null;
 
          session2 = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
          cons2 = session2.createConsumer(queue1);
@@ -571,8 +576,14 @@
             
             if (checkNoMessageData())
             {
-               while (cons1.receive(100) != null);
-               while (cons2.receive(100) != null);
+               if (cons1 != null)
+               {
+                  while (cons1.receive(100) != null);
+               }
+               if (cons2 != null)
+               {
+                  while (cons2.receive(100) != null);
+               }
 
                session1.commit();
                session2.commit();




More information about the jboss-cvs-commits mailing list