Package java.util.concurrent

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


      // Wait for the cache server to start up.
      boolean started = false;
      try
      {
         started = startedSignal.await(120, TimeUnit.SECONDS);
      }
      catch (InterruptedException e)
      {
         // do nothing
      }
View Full Code Here


        MyReceiver receiver=new MyReceiver(latch);
        ch.setReceiver(receiver);
        ch.connect(GROUP);

        System.out.println("Waiting for " + num_mbrs + " members");
        latch.await();
        View view=ch.getView();
        Address local_addr=ch.getAddress();
        Address dest=pickNextMember(view, local_addr);
        System.out.println("View is " + view + "\n" + num_threads + " threads are sending " + num_msgs + " messages (of " + size + " bytes) to " + dest);
View Full Code Here

            tasks[i] = new Task() {
                public void call() throws Exception {
                    for (int a = 0; a < count; a++) {
                        connList[x].createStatement().execute("update test set value=value+1");
                        latch.countDown();
                        latch.await();
                    }
                }
            };
            tasks[i].execute();
        }
View Full Code Here

      
       startLatch.countDown();
      
       try
       {
          boolean finished = finishLatch.await(20, TimeUnit.SECONDS);
         
          if (connectA.exception != null)
          {
             AssertJUnit.fail("connectA threw exception " + connectA.exception);
          }
View Full Code Here

        stopFlushLatch.countDown();

        t1.join();
        t2.join();

        assertTrue(flushStopReceived.await(60, TimeUnit.SECONDS));


        assert l1.blockReceived;
        assert l1.unblockReceived;
        assert l2.blockReceived;
View Full Code Here

        stopFlushLatch.countDown();

        t1.join();
        t2.join();

        assertTrue(flushStopReceived.await(60, TimeUnit.SECONDS));

        assert l1.blockReceived;
        assert l1.unblockReceived;
        assert l2.blockReceived;
        assert l2.unblockReceived;
View Full Code Here

    for (int i = 0; i < THREAD_COUNT; i++) {
      callables.add(new Callable<Object>() {
        public Object call() throws Exception {
          latch.countDown();
          latch.await();
          Mapper processor = mapper.getMappingProcessor();
          assertNotNull(processor);
          return null;
        }
      });
View Full Code Here

          }
        }
      }).start();

    }
    latch.await();
    assertTrue(exceptions.isEmpty());
  }

  class CallTrackingMapper extends DozerBeanMapper {
    AtomicInteger calls = new AtomicInteger(0);
View Full Code Here

        Assert.assertNotNull(request);

        //now wait until we're complete, but bail if we wait too long
        boolean completed;
        try {
            completed = complete.await(maximumWaitValue, maximumWaitUnits);
        } catch (InterruptedException e) {
            throw UncheckedException.asUncheckedException(e);
        }

        gradlePluginLord.removeRequestObserver( observer );
View Full Code Here

        http.write(("" +
                "GET /index.html HTTP/1.1\r\n" +
                "Host: www.example.com\r\n\r\n").getBytes("UTF-8"));
        http.flush();

        assertTrue("Server should have stopped by now", stopper.await(1000, TimeUnit.MILLISECONDS));
    }

    private int getCurrentThreadCount() {
        return Thread.getAllStackTraces().keySet().size();
    }
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.