Skip to content

Commit

Permalink
Fix testActiveAndInActiveConsumerEntryCacheBehavior (apache#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdhabalia authored and merlimat committed Oct 4, 2017
1 parent 4408204 commit df5be46
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ public void testActiveAndInActiveConsumerEntryCacheBehavior() throws Exception {
msg = subscriber1.receive(5, TimeUnit.SECONDS);

// Verify: cache has to be cleared as there is no message needs to be consumed by active subscriber
assertTrue(entryCache.getSize() == 0);
assertEquals(entryCache.getSize(), 0, 1);

/************ usecase-2: *************/
// 1.b Subscriber slower-subscriber
Expand Down Expand Up @@ -763,7 +763,18 @@ public void testActiveAndInActiveConsumerEntryCacheBehavior() throws Exception {

// 3.b Close subscriber2: which will trigger cache to clear the cache
subscriber2.close();


// retry strategically until broker clean up closed subscribers and invalidate all cache entries
int retry = 5;
for (int i = 0; i < retry; i++) {
if (entryCache.getSize() != 0) {
if (i != retry - 1) {
Thread.sleep(100);
}
} else {
break;
}
}
// Verify: EntryCache should be cleared
assertTrue(entryCache.getSize() == 0);
subscriber1.close();
Expand Down

0 comments on commit df5be46

Please sign in to comment.