4142434445464748495051
} for (int i = 100; i > 0; i--) { Assert.assertEquals(i, latch.getCount()); latch.down(); Assert.assertEquals(i - 1, latch.getCount()); } latch.waitCompletion(); }
175176177178179180181182183184185
// Everybody should start at the same time, to worse concurrency // effects latchStart.await(); for (int i = 0; i < numberOfAdds; i++) { latch.down(); } } catch (Exception e) { VariableLatchTest.log.error(e.getMessage(), e);
211212213214215216217218219220221
for (int i = 0; i < numberOfThreads; i++) { Assert.assertTrue(waits[i].waiting); } latch.down(); for (int i = 0; i < numberOfThreads; i++) { waits[i].join(); }
267268269270271272273274275276277
t.readyLatch.await(); Assert.assertEquals(true, t.waiting); latch.down(); t.join(); Assert.assertEquals(false, t.waiting);
284285286287288289290291292293294
296297298299300301302303304305306
Assert.assertTrue(latch.waitCompletion(1000)); Assert.assertEquals(0, latch.getCount()); latch.down(); Assert.assertEquals(0, latch.getCount()); }