Package org.hornetq.utils

Examples of org.hornetq.utils.VariableLatch.up()


{
   public void testTimeout() throws Exception
   {
      VariableLatch latch = new VariableLatch();

      latch.up();

      long start = System.currentTimeMillis();
      Assert.assertFalse(latch.waitCompletion(1000));
      long end = System.currentTimeMillis();
View Full Code Here


   {
      VariableLatch latch = new VariableLatch();

      for (int i = 1; i <= 100; i++)
      {
         latch.up();
         Assert.assertEquals(i, latch.getCount());
      }

      for (int i = 100; i > 0; i--)
      {
View Full Code Here

    */
   public void testLatchOnMultiThread() throws Exception
   {
      final VariableLatch latch = new VariableLatch();

      latch.up(); // We hold at least one, so ThreadWaits won't go away

      final int numberOfThreads = 100;
      final int numberOfAdds = 100;

      class ThreadWait extends Thread
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.up();
               }
            }
            catch (Exception e)
            {
               VariableLatchTest.log.error(e.getMessage(), e);
View Full Code Here

   }

   public void testReuseLatch() throws Exception
   {
      final VariableLatch latch = new VariableLatch();
      latch.up();

      class ThreadWait extends Thread
      {
         private volatile boolean waiting = false;
View Full Code Here

      Assert.assertEquals(false, t.waiting);

      Assert.assertNull(t.e);

      latch.up();

      t = new ThreadWait();
      t.start();

      t.readyLatch.await();
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.