Package java.util.concurrent

Examples of java.util.concurrent.ThreadPoolExecutor.execute()


       
        executor.execute(new ControlWorker(helloPort, "Harry", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "Harry", "", startSignal, helloDoneSignal));
       
        executor.execute(new ControlWorker(helloPort, "Rob", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "Rob", "Davidson", startSignal, helloDoneSignal));
       
        executor.execute(new ControlWorker(helloPort, "James", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "James", "ServiceMix", startSignal, helloDoneSignal));
       
        startSignal.countDown();
View Full Code Here


        executor.execute(new HelloWorker(helloPort, "Harry", "", startSignal, helloDoneSignal));
       
        executor.execute(new ControlWorker(helloPort, "Rob", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "Rob", "Davidson", startSignal, helloDoneSignal));
       
        executor.execute(new ControlWorker(helloPort, "James", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "James", "ServiceMix", startSignal, helloDoneSignal));
       
        startSignal.countDown();
       
        controlDoneSignal.await(100, TimeUnit.SECONDS);
View Full Code Here

       
        executor.execute(new ControlWorker(helloPort, "Rob", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "Rob", "Davidson", startSignal, helloDoneSignal));
       
        executor.execute(new ControlWorker(helloPort, "James", startSignal, controlDoneSignal));
        executor.execute(new HelloWorker(helloPort, "James", "ServiceMix", startSignal, helloDoneSignal));
       
        startSignal.countDown();
       
        controlDoneSignal.await(100, TimeUnit.SECONDS);
        helloDoneSignal.await(100, TimeUnit.SECONDS);
View Full Code Here

        .requestDelayMilliseconds()));

    final ExecutorCounter counter = new ExecutorCounter();

    try {
      executor
          .execute(new PageCrawlerExecutor(new Url(config.beginUrl(), 0), executor, counter, config
              .downloader(), config.normalizer(), new DoesNotFollowVisitedUrlVisitor(config.beginUrl(),
              visitor)));

      while (counter.value() != 0) {
View Full Code Here

        }
        if (p == null) {
            throw new IllegalStateException("ThreadPool has been stopped");
        }
        Runnable task = new ContextClassLoaderRunnable(command, classLoader);
        p.execute(task);
    }

    private synchronized void startWork(String consumerName) {
        Integer test = (Integer) clients.get(consumerName);
        if (test == null) {
View Full Code Here

                    // Listen on main socket
                    Socket clientSocket = mainSocket.accept();
                    if (running) {
                        // Pass request to new thread
                        if(threadPoolExecutor != null) {
                            threadPoolExecutor.execute(new HttpMirrorThread(clientSocket));
                        } else {
                            Thread thd = new Thread(new HttpMirrorThread(clientSocket));
                            log.debug("Starting new Mirror thread");
                            thd.start();
                        }
View Full Code Here

        ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 5, 0, TimeUnit.SECONDS,
                                                             new ArrayBlockingQueue<Runnable>(10));
        CountDownLatch startSignal = new CountDownLatch(1);
        CountDownLatch doneSignal = new CountDownLatch(5);
       
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/1",
                                        "1",
                                        "CXF in Action1", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
View Full Code Here

        CountDownLatch doneSignal = new CountDownLatch(5);
       
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/1",
                                        "1",
                                        "CXF in Action1", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/3",
                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
View Full Code Here

                                        "1",
                                        "CXF in Action1", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/3",
                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/4",
                                        "4",
                                        "CXF in Action4", startSignal, doneSignal));
View Full Code Here

                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/3",
                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/4",
                                        "4",
                                        "CXF in Action4", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + port + "/bookstore/" + pathSegment + "/5",
                                        "5",
                                        "CXF in Action5", startSignal, doneSignal));
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.