Author: clebert.suconic(a)jboss.com
Date: 2011-03-22 16:15:16 -0400 (Tue, 22 Mar 2011)
New Revision: 10352
Modified:
branches/Branch_2_2_EAP/tests/jms-tests/src/org/hornetq/jms/tests/DeliveryOrderTest.java
Log:
JBPAPP-6034 - increasing timeouts to avoid failures
Modified:
branches/Branch_2_2_EAP/tests/jms-tests/src/org/hornetq/jms/tests/DeliveryOrderTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/jms-tests/src/org/hornetq/jms/tests/DeliveryOrderTest.java 2011-03-22
13:57:39 UTC (rev 10351)
+++
branches/Branch_2_2_EAP/tests/jms-tests/src/org/hornetq/jms/tests/DeliveryOrderTest.java 2011-03-22
20:15:16 UTC (rev 10352)
@@ -50,7 +50,7 @@
Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
- Session sess2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sess2 = conn.createSession(true, Session.SESSION_TRANSACTED);
MessageProducer prod = sess.createProducer(HornetQServerTestCase.queue1);
@@ -60,7 +60,7 @@
final int NUM_MESSAGES = 1000;
- MyListener listener = new MyListener(latch, NUM_MESSAGES);
+ MyListener listener = new MyListener(latch, sess2, NUM_MESSAGES);
cons.setMessageListener(listener);
@@ -81,7 +81,7 @@
// need extra commit for cases in which the last message index is not a multiple
of 10
sess.commit();
- latch.await(20000, MILLISECONDS);
+ assertTrue(latch.await(20000, MILLISECONDS));
if (listener.failed)
{
@@ -109,11 +109,14 @@
private volatile boolean failed;
private String error;
+
+ private final Session sess;
- MyListener(final CountDownLatch latch, final int num)
+ MyListener(final CountDownLatch latch, final Session sess, final int num)
{
this.latch = latch;
this.num = num;
+ this.sess = sess;
}
public void onMessage(final Message msg)
@@ -124,6 +127,9 @@
return;
}
+
+ System.out.println("Message " + msg);
+
try
{
TextMessage tm = (TextMessage)msg;
@@ -137,18 +143,16 @@
}
c++;
+
+ if (c % 500 == 0)
+ {
+ sess.commit();
+ }
if (c == num)
{
+ sess.commit();
latch.countDown();
-
- try
- {
- Thread.sleep(2000);
- }
- catch (Exception e)
- {
- }
}
}
catch (JMSException e)
Show replies by date