Package java.util.concurrent

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


                                        "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));
       
        startSignal.countDown();
        doneSignal.await(60, TimeUnit.SECONDS);
View Full Code Here


        ThreadPoolExecutor executor = new ThreadPoolExecutor(20, 20, 1000, TimeUnit.MILLISECONDS,
                                                             new ArrayBlockingQueue<Runnable>(10));
        for (int i = 0; i < 20; i++) {
            final int threadCount = i;
            executor.execute(new Runnable() {
                public void run() {
                    int start = threadCount * group;
                    for (int i = 0; i < group; i++) {
                        try {
                            // do some random sleep to simulate spread in user activity
View Full Code Here

      HashSet<OrRunnable> l = new HashSet<OrRunnable>();
      for (final IComplexQueryRequest z : s) {
        OrRunnable runnable = new OrRunnable(z);
        l.add(runnable);
        px.execute(runnable);
      }
      l2: while ((!monitor.isCanceled())
          && (px.getCompletedTaskCount() != l.size())) {
        {
          try {
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

        //only uses the queue if we've reached the maximum number
        //of threads.   Thus, we'll set the core size to the max,
        //add the runnable, and set back.  That will cause the
        //threads to be created as needed.
        ThreadPoolExecutor ex = getExecutor();
        ex.execute(r);
        if (!ex.getQueue().isEmpty() && this.getPoolSize() < highWaterMark) {
            mainLock.lock();
            try {
                int ps = this.getPoolSize();
                int sz = executor.getQueue().size();
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/books/1",
                                        "1",
                                        "CXF in Action1", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
View Full Code Here

        CountDownLatch doneSignal = new CountDownLatch(5);
       
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/1",
                                        "1",
                                        "CXF in Action1", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/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/books/2",
                                        "2",
                                        "CXF in Action2", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/3",
                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/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/books/3",
                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/4",
                                        "4",
                                        "CXF in Action4", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/5",
                                        "5",
                                        "CXF in Action5", startSignal, doneSignal));
View Full Code Here

                                        "3",
                                        "CXF in Action3", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/4",
                                        "4",
                                        "CXF in Action4", startSignal, doneSignal));
        executor.execute(new BookWorker("http://localhost:" + PORT + "/bookstore/books/5",
                                        "5",
                                        "CXF in Action5", startSignal, doneSignal));
       
        startSignal.countDown();
        doneSignal.await(60, TimeUnit.SECONDS);
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.