Package java.util.concurrent

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


            final CountDownLatch latch = new CountDownLatch(10);

            ExecutorService notificationsPool = Executors.newFixedThreadPool(4);
            notificationsPool.submit(new Callable<Void>() {
                public Void call() throws Exception {
                    trigger.await();
                    while (condition.get()) {
                        fNotifier.fireTestStarted(null);
                        latch.countDown();
                    }
                    fNotifier.fireTestStarted(null);
View Full Code Here


                    return null;
                }
            });

            // Wait for callable to start
            trigger.await(TIMEOUT, TimeUnit.SECONDS);

            // Wait for callable to fire a few events
            latch.await(TIMEOUT, TimeUnit.SECONDS);

            for (ExaminedListener examinedListener : examinedListeners) {
View Full Code Here

      TestProtocol.class, TestProtocol.versionID, addr, conf);
      Thread rpcThread = new Thread(new Runnable() {
        @Override
        public void run() {
          try {
            barrier.await();
            while (num == 0 || leaderRunning.get()) {
              proxy.slowPing(false);
            }
           
            proxy.slowPing(false);
View Full Code Here

        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock("a0") {
            @Override
            protected void hook() throws InterruptedException, IOException {
                try {
                    barrier.await();
                } catch (BrokenBarrierException e) {
                    throw new IOException(e);
                }
            }
        }.resource("para"));
View Full Code Here

        }.resource("para"));
        jobs.add(new Mock("a2") {
            @Override
            protected void hook() throws InterruptedException, IOException {
                try {
                    barrier.await();
                } catch (BrokenBarrierException e) {
                    throw new IOException(e);
                }
            }
        }.resource("para"));
View Full Code Here

        }.resource("para"));
        jobs.add(new Mock("a3") {
            @Override
            protected void hook() throws InterruptedException, IOException {
                try {
                    barrier.await();
                } catch (BrokenBarrierException e) {
                    throw new IOException(e);
                }
            }
        }.resource("otherwise"));
View Full Code Here

                        workers[i] = new Worker(barrier, requestsCount, sessionCookie, urls);
                        workers[i].start();
                        executor.execute(workers[i]);
                    }
                    // Wait for all workers to be ready
                    barrier.await();
                    long start = System.nanoTime();

                    // Wait for all workers to be done
                    barrier.await();
                    long end = System.nanoTime();
View Full Code Here

                    // Wait for all workers to be ready
                    barrier.await();
                    long start = System.nanoTime();

                    // Wait for all workers to be done
                    barrier.await();
                    long end = System.nanoTime();
                    long elapsed = TimeUnit.NANOSECONDS.toMillis(end - start);
                    System.out.println("elapsed ms: " + elapsed);

                    for (Worker worker : workers) worker.stop();
View Full Code Here

                        workers[i] = new Worker(barrier, requestsCount, sessionCookie, urls);
                        workers[i].start();
                        executor.execute(workers[i]);
                    }
                    // Wait for all workers to be ready
                    barrier.await();
                    long start = System.nanoTime();

                    // Wait for all workers to be done
                    barrier.await();
                    long end = System.nanoTime();
View Full Code Here

                    // Lock until we finished
                    SessionReplayImpl.this.finishedLock.lock();

                    // Synchronize with exit of the function
                    try {
                        barrier.await();
                    } catch (final InterruptedException e) {
                        e.printStackTrace();
                    } catch (final BrokenBarrierException e) {
                        e.printStackTrace();
                    }
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.