Package java.util.concurrent

Examples of java.util.concurrent.CountDownLatch.await()


        public void onFailure(Throwable ignore) { }
      };
      // make sure that the http.fetch(..) is invoked from the ioloop thread
      IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { http.fetch(url, cb); }});
      latch.await(5, TimeUnit.SECONDS);
      assertEquals(0, latch.getCount());
      assertEquals("hello test", result[0]);
      assertEquals("HTTP/1.1 200 OK", result[1]);
    }
  }
View Full Code Here


      public void onFailure(Throwable e) { if (e instanceof ConnectException) latch.countDown(); }
    };
    // make sure that the http.fetch(..) is invoked from the ioloop thread
    IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { http.fetch(url, cb); }});
    latch.await(5, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
  }
 
 
  public String convertStreamToString(InputStream is) throws IOException {
View Full Code Here

         {
            public void run()
            {
               try
               {
                  latch.await();
               }
               catch (InterruptedException e)
               {
               }
View Full Code Here

      final CountDownLatch pushStateCanFinish = new CountDownLatch(1);
      final CountDownLatch secondActiveStatusChangerCanStart = new CountDownLatch(1);
      final MockSingletonStoreCacheLoader mscl = new MockSingletonStoreCacheLoader(pushStateCanFinish, secondActiveStatusChangerCanStart, new SingletonStoreDefaultConfig());

      Future f1 = executor.submit(createActiveStatusChanger(mscl));
      secondActiveStatusChangerCanStart.await();

      Future f2 = executor.submit(createActiveStatusChanger(mscl));

      f1.get();
      f2.get();
View Full Code Here

      SingletonStoreDefaultConfig ssdc = new SingletonStoreDefaultConfig();
      ssdc.setPushStateWhenCoordinatorTimeout(1000);
      final MockSingletonStoreCacheLoader mscl = new MockSingletonStoreCacheLoader(pushStateCanFinish, null, ssdc);

      Future f = Executors.newSingleThreadExecutor().submit(createActiveStatusChanger(mscl));
      pushStateCanFinish.await(2000, TimeUnit.MILLISECONDS);
      pushStateCanFinish.countDown();

      try
      {
         f.get();
View Full Code Here

      {
         public void run()
         {
            try
            {
               latch.await();
               for (int i = 0; i < loops; i++)
               {
                  Fqn f = singleFqn ? fqn : fqns.get(r.nextInt(fqns.size()));
                  cache1.evict(f);
                  TestingUtil.sleepRandom(50);
View Full Code Here

      {
         public void run()
         {
            try
            {
               latch.await();
               for (int i = 0; i < loops; i++)
               {
                  Fqn f = singleFqn ? fqn : fqns.get(r.nextInt(fqns.size()));
                  cache2.put(f, "k", "v");
                  TestingUtil.sleepRandom(50);
View Full Code Here

      {
         public void run()
         {
            try
            {
               latch.await();
               for (int i = 0; i < loops; i++)
               {
                  loader1.get(singleFqn ? fqn : fqns.get(r.nextInt(fqns.size())));
                  TestingUtil.sleepRandom(50);
               }
View Full Code Here

      {
         public void run()
         {
            try
            {
               latch.await();
               for (int i = 0; i < loops; i++)
               {
                  loader1.getChildrenNames(singleFqn ? fqn : fqns.get(r.nextInt(fqns.size())));
                  TestingUtil.sleepRandom(50);
               }
View Full Code Here

         {
            public void run()
            {
               try
               {
                  latch.await();
               }
               catch (InterruptedException e)
               {
                  // do nothing
               }
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.