Package java.util.concurrent

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


            adders[i]=new Adder(unicast, latch, counter, seqno, oob, local_addr, sender);
            adders[i].start();
        }

        long start=System.currentTimeMillis();
        latch.countDown(); // starts all adders

        lock.lock();
        try {
            while(delivered_msgs.get() < num_msgs) {
                try {
View Full Code Here


            adders[i]=new Sender(unicast, latch, counter, seqno, oob, local_addr, sender);
            adders[i].start();
        }

        long start=System.currentTimeMillis();
        latch.countDown(); // starts all adders

        lock.lock();
        try {
            while(delivered_msgs.get() < num_msgs) {
                try {
View Full Code Here

            adders[i]=new Sender(nak, latch, counter, seqno, oob, sender);
            adders[i].start();
        }

        long start=System.currentTimeMillis();
        latch.countDown(); // starts all adders

        lock.lock();
        try {
            while(delivered_msgs.get() < num_msgs) {
                try {
View Full Code Here

            adders[i]=new Adder(1, NUM, 10, win, latch);
        }
        for(Adder adder: adders)
            adder.start();

        latch.countDown();

        for(Adder adder: adders)
            adder.join();

        System.out.println("win = " + win);
View Full Code Here

        for(int i=0; i < removers.length; i++) {
            removers[i]=new Remover(win, latch, count);
            removers[i].start();
        }

        latch.countDown();

        for(Adder adder: adders)
            adder.join();

        int total=0;
View Full Code Here

        @Override
        public void run() {
          try {
            doSimpleGetRequest();
            latch.countDown();
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
View Full Code Here

  public void timeoutTest() throws InterruptedException {
    long now = System.currentTimeMillis();
    final CountDownLatch latch = new CountDownLatch(5);
    final AsyncCallback cb = new AsyncCallback() {

      @Override public void onCallback() { latch.countDown(); }

    };

    Timeout t1 = new Timeout(now+1000, cb);
    Timeout t2 = new Timeout(now+1200, cb);
View Full Code Here

  @Test
  public void callbackTest() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(5);
    final AsyncCallback cb = new AsyncCallback() {

      @Override public void onCallback() { latch.countDown(); }
   
    };
    IOLoop.INSTANCE.addCallback(cb);
    IOLoop.INSTANCE.addCallback(cb);
    IOLoop.INSTANCE.addCallback(cb);
View Full Code Here

            for (String header : expectedHeaders) {
              assertTrue(response.getHeader(header) != null);
            }
            assertEquals(expectedPayload.length()+"", response.getHeader("Content-Length"));
          }
          latch.countDown();
          return response;
        }

        @Override
        public void onThrowable(Throwable t){
View Full Code Here

        assertEquals(200, response.getStatusCode());
        assertEquals("OK", response.getStatusText());
        assertEquals(5, response.getHeaders().size());
        String payLoad = response.getResponseBody();
        assertEquals(body, payLoad);
        latch.countDown();
        return response;
      }

      @Override
      public void onThrowable(Throwable t) { }
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.