Package java.util.concurrent

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


        int timeoutToConverge=120;
        boolean successConnecting  = false;
        try {
            // Wait for all channels to finish connecting
            successConnecting=latch.await(timeoutToConverge, TimeUnit.SECONDS);           
            if(successConnecting) {
                log.info("All connected. Converging...");
                for(Task t:tasks) {
                    Throwable ex=t.getException();
                    if(ex != null)
View Full Code Here


        }

      });
    }
    try {
      latch.await(15 * 1000, TimeUnit.MILLISECONDS)// max wait time
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    if (latch.getCount() != 0) {
      assertTrue("Did not finish " + nRequests + " # of requests", false);
View Full Code Here

    IOLoop.INSTANCE.addTimeout(t2);
    IOLoop.INSTANCE.addTimeout(t3);
    IOLoop.INSTANCE.addTimeout(t4);
    IOLoop.INSTANCE.addTimeout(t5);

    latch.await(5 * 1000, TimeUnit.MILLISECONDS);
    assertTrue(latch.getCount() == 0);
  }
 
  @Test
  public void callbackTest() throws InterruptedException {
View Full Code Here

    IOLoop.INSTANCE.addCallback(cb);
    IOLoop.INSTANCE.addCallback(cb);
    IOLoop.INSTANCE.addCallback(cb);
    IOLoop.INSTANCE.addCallback(cb);
   
    latch.await(5 * 1000, TimeUnit.MILLISECONDS);
    assertTrue(latch.getCount() == 0);
  }

  @Test
  public void keyValueStoreClientTest() throws ClientProtocolException, IOException {
View Full Code Here

          assertTrue(false);
        }

      });
    }
    latch.await(15 * 1000, TimeUnit.MILLISECONDS);
    assertEquals(0, latch.getCount());
  }
 
  // TODO 101108 RS enable when /mySql (AsyncDbHandler is properly implemented)
  //ning === http://github.com/ning/async-http-client
View Full Code Here

      @Override
      public void onThrowable(Throwable t) { }
    });

    latch.await();
    assertTrue(latch.getCount() == 0);
  }
 
  @Test
  public void largeHttpPostBodyTest() throws ClientProtocolException, IOException, InterruptedException {
View Full Code Here

      @Override
      public void onThrowable(Throwable t) { }
    });

    latch.await();
    assertTrue(latch.getCount() == 0);
  }
 
  @Test
  public void authenticatedRequestHandlerTest() throws ClientProtocolException, IOException {
View Full Code Here

    final CountDownLatch latch = new CountDownLatch(n);
    for (int i = 0; i < n; i++) {
      IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { server.listen(PORT+1); }});
      IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { server.stop(); latch.countDown(); }});
    }
    latch.await(5, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
  }
 
  @Test
  public void connectToUnresolvableAddressUsingAsynchronousHttpClient() throws InterruptedException {
View Full Code Here

        });
      }
    };
    IOLoop.INSTANCE.addCallback(runByIOLoop);
   
    latch.await(30, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
  }

  @Test
  public void connectToUnconnectableAddressUsingAsynchronousHttpClient() throws InterruptedException {
View Full Code Here

        });
      }
    };
    IOLoop.INSTANCE.addCallback(runByIOLoop);
   
    latch.await(30, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
  }
 
  @Test
  public void multipleAsynchronousHttpClientTest() throws InterruptedException {
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.