Skip to content

Commit

Permalink
Merge pull request hornetq#1549 from clebertsuconic/master-fix
Browse files Browse the repository at this point in the history
fixing failover test
  • Loading branch information
clebertsuconic committed Feb 24, 2014
2 parents b292505 + e5842b3 commit 5e8cb93
Showing 1 changed file with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

});
Expand All @@ -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
Expand Down

0 comments on commit 5e8cb93

Please sign in to comment.