Permalink
Browse files

Merge pull request #1549 from clebertsuconic/master-fix

fixing failover test
  • Loading branch information...
2 parents b292505 + e5842b3 commit 5e8cb93a64d0cb538abc1c36979445b6660024e8 @clebertsuconic clebertsuconic committed Feb 24, 2014
@@ -518,17 +518,16 @@ public void testNonTransactedWithZeroConsumerWindowSize() throws Exception
producer.send(message);
}
- int winSize = 0;
- ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS, null, winSize, 100, false);
+ ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
- final List<ClientMessage> received = new ArrayList<ClientMessage>();
+ final CountDownLatch latch = new CountDownLatch(NUM_MESSAGES);
consumer.setMessageHandler(new MessageHandler()
{
public void onMessage(ClientMessage message)
{
- received.add(message);
+ latch.countDown();
}
});
@@ -537,19 +536,8 @@ public void onMessage(ClientMessage message)
crash(session);
- int retry = 0;
- while (received.size() < NUM_MESSAGES)
- {
- Thread.sleep(100);
- retry++;
- if (retry > 50)
- {
- break;
- }
- }
- session.close();
- final int retryLimit = 5;
- Assert.assertTrue("Number of retries (" + retry + ") should be <= " + retryLimit, retry <= retryLimit);
+ assertTrue(latch.await(1, TimeUnit.SECONDS));
+
}
private void createClientSessionFactory() throws Exception

0 comments on commit 5e8cb93

Please sign in to comment.