Package org.hornetq.utils

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


      VariableLatch latch = new VariableLatch();

      latch.up();

      long start = System.currentTimeMillis();
      Assert.assertFalse(latch.waitCompletion(1000));
      long end = System.currentTimeMillis();

      Assert.assertTrue("Timeout didn't work correctly", end - start >= 1000 && end - start < 2000);
   }
}
View Full Code Here


         Assert.assertEquals(i, latch.getCount());
         latch.down();
         Assert.assertEquals(i - 1, latch.getCount());
      }

      latch.waitCompletion();
   }

   /**
    *
    * This test will open numberOfThreads threads, and add numberOfAdds on the
View Full Code Here

         @Override
         public void run()
         {
            try
            {
               if (!latch.waitCompletion(5000))
               {
                  VariableLatchTest.log.error("Latch timed out");
               }
            }
            catch (Exception e)
View Full Code Here

         {
            waiting = true;
            readyLatch.countDown();
            try
            {
               if (!latch.waitCompletion(1000))
               {
                  VariableLatchTest.log.error("Latch timed out!", new Exception("trace"));
               }
            }
            catch (Exception e)
View Full Code Here

      Assert.assertEquals(false, t.waiting);

      Assert.assertNull(t.e);

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

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

      latch.down();
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.