4546474849505152535455
Assert.assertEquals(i, latch.getCount()); latch.countDown(); Assert.assertEquals(i - 1, latch.getCount()); } latch.await(); } /** * * This test will open numberOfThreads threads, and add numberOfAdds on the
7778798081828384858687
@Override public void run() { try { if (!latch.await(5000)) { ReusableLatchTest.log.error("Latch timed out"); } } catch (Exception e)
251252253254255256257258259260261
{ waiting = true; readyLatch.countDown(); try { if (!latch.await(1000)) { ReusableLatchTest.log.error("Latch timed out!", new Exception("trace")); } } catch (Exception e)
297298299300301302303304305306307
Assert.assertEquals(false, t.waiting); Assert.assertNull(t.e); Assert.assertTrue(latch.await(1000)); Assert.assertEquals(0, latch.getCount()); latch.countDown();
819820821822823824825826827828829
{ reusableLatchDone.countDown(); System.out.println("Waiting on Compact"); try { reusableLatchWait.await(); } catch (InterruptedException e) { e.printStackTrace(); }
972973974975976977978979980981982
10681069107010711072107310741075107610771078
3536373839404142434445
{ ReusableLatch latch = new ReusableLatch(1000); latch.countDown(5000); assertTrue(latch.await(1000)); assertEquals(0, latch.getCount()); }
5859606162636465666768
90919293949596979899100