Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ public void testDownAndUp() throws Exception {

Assert.assertEquals(0, semaphore.getCredits());

long timeout = System.currentTimeMillis() + 1000;
while (!semaphore.hasQueuedThreads() && System.currentTimeMillis() < timeout) {
// TODO: Wait.assertTrue is not available at this package. So, this is making what we would be doing with a Wait Clause
// we could replace this next block with a Wait clause on hasQueuedThreads
int i = 0;
for (i = 0; i < 1000 && !semaphore.hasQueuedThreads(); i++) {
Thread.sleep(10);
}

Assert.assertTrue(semaphore.hasQueuedThreads());
Assert.assertTrue(i < 1000);

semaphore.release(2);

Expand Down