Package org.hornetq.utils

Examples of org.hornetq.utils.ReusableLatch.countDown()


      }

      for (int i = 100; i > 0; i--)
      {
         Assert.assertEquals(i, latch.getCount());
         latch.countDown();
         Assert.assertEquals(i - 1, latch.getCount());
      }

      latch.await();
   }
View Full Code Here


               // Everybody should start at the same time, to worse concurrency
               // effects
               latchStart.await();
               for (int i = 0; i < numberOfAdds; i++)
               {
                  latch.countDown();
               }
            }
            catch (Exception e)
            {
               ReusableLatchTest.log.error(e.getMessage(), e);
View Full Code Here

      for (int i = 0; i < numberOfThreads; i++)
      {
         Assert.assertTrue(waits[i].waiting);
      }

      latch.countDown();

      for (int i = 0; i < numberOfThreads; i++)
      {
         waits[i].join();
      }
View Full Code Here

   public void testReuseLatch() throws Exception
   {
      final ReusableLatch latch = new ReusableLatch(5);
      for (int i = 0 ; i < 5; i++)
      {
         latch.countDown();
      }

      latch.countUp();

      class ThreadWait extends Thread
View Full Code Here

      t.readyLatch.await();

      Assert.assertEquals(true, t.waiting);

      latch.countDown();

      t.join();

      Assert.assertEquals(false, t.waiting);
View Full Code Here

      t.readyLatch.await();

      Assert.assertEquals(true, t.waiting);

      latch.countDown();

      t.join();

      Assert.assertEquals(false, t.waiting);
View Full Code Here

      Assert.assertTrue(latch.await(1000));

      Assert.assertEquals(0, latch.getCount());

      latch.countDown();

      Assert.assertEquals(0, latch.getCount());

   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.