Package java.util.concurrent

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


            changeViewBundling(channels[i]);
            replaceDiscoveryProtocol(channels[i]);
        }

        for(final Task t:tasks) {
            executor.execute(t);
        }

        int timeoutToConverge=120;
        boolean successConnecting  = false;
        try {
View Full Code Here


        ExecutorService exec = Executors.newFixedThreadPool(64);
        final int len = tests.length;
        final AtomicInteger counter = new AtomicInteger(0);
        try {
            for(int i = 0; i < len; i++) {
                exec.execute(new Runnable() {
                    public void run() {
                        int nth = counter.getAndIncrement();
                        String testfilename = tests[nth];
                        String test = FileUtils.basename(testfilename) + "#" + nth;
                        //String[] args = new String[] { "-q", testfilename, "-o", OUTPUT_DEST + test };
View Full Code Here

    public void run(final TestResult result) {
        final ExecutorService exec = Executors.newFixedThreadPool(nthreads);
        final Enumeration<Test> tests = tests();
        while(tests.hasMoreElements()) {
            final Test test = tests.nextElement();
            exec.execute(new Runnable() {
                public void run() {
                    try {
                        test.run(result);
                    } catch (Throwable e) {
                        e.printStackTrace();
View Full Code Here

        final ExecutorService execPool = this.execPool;
        final TransferRequestListener handler = this.handler;
        try {
            while(true) {
                SocketChannel channel = serverChannel.accept();
                execPool.execute(new RequestHandler(channel, handler));
            }
        } catch (ClosedByInterruptException interrupted) {
            if(LOG.isDebugEnabled()) {
                LOG.debug("Avoidable interrupt happened (Normal case): " + interrupted.getMessage());
            }
View Full Code Here

                                    + request.getIdentifier() + " at " + endpoint, e);
                        }
                        results[at] = res;
                    }
                };
                ex.execute(r);
            }
        } finally {
            ExecutorUtils.shutdownAndAwaitTermination(ex);
        }
        assert (ex.isTerminated());
View Full Code Here

    String title = null;
    ExecutorService service = null;
    try {
      FetchRssDataWorker worker = new FetchRssDataWorker(url);
      service = Executors.newFixedThreadPool(1);
      service.execute(worker);
      service.shutdown();
      service.awaitTermination(5, TimeUnit.SECONDS);
      title = worker.getRssTitle();
      logger.debug("detected RSS title: " + title);
    } catch (Exception e) {
View Full Code Here

     
      CountDownLatch startLatch = new CountDownLatch(4);
      CountDownLatch finishLatch = new CountDownLatch(3);
     
      DeploymentTask warTask = new DeploymentTask(startLatch, finishLatch, war);
      executor.execute(warTask);
     
      DeploymentTask jarTask = new DeploymentTask(startLatch, finishLatch, jar);
      executor.execute(jarTask);
     
      DeploymentTask appclientTask = new DeploymentTask(startLatch, finishLatch, appClient);
View Full Code Here

     
      DeploymentTask warTask = new DeploymentTask(startLatch, finishLatch, war);
      executor.execute(warTask);
     
      DeploymentTask jarTask = new DeploymentTask(startLatch, finishLatch, jar);
      executor.execute(jarTask);
     
      DeploymentTask appclientTask = new DeploymentTask(startLatch, finishLatch, appClient);
      executor.execute(appclientTask);
     
      startLatch.countDown();
View Full Code Here

     
      DeploymentTask jarTask = new DeploymentTask(startLatch, finishLatch, jar);
      executor.execute(jarTask);
     
      DeploymentTask appclientTask = new DeploymentTask(startLatch, finishLatch, appClient);
      executor.execute(appclientTask);
     
      startLatch.countDown();
     
      assertTrue(finishLatch.await(5, TimeUnit.SECONDS));
     
View Full Code Here

    private void compare(Thread[] t) throws InterruptedException {
    ExecutorService pool =
      Executors.newFixedThreadPool(t.length);
   
        for (Thread ti : t)
            pool.execute(ti);
   
    pool.shutdown();
    pool.awaitTermination(20, TimeUnit.SECONDS);

        for (int i = 0; i < x.size(); ++i)
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.