Examples of invokeAll()


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

    callables = wrapWithStatsCallables(callables, noEstimateCounter);
    int numProcessors = Runtime.getRuntime().availableProcessors();
    ExecutorService executor = Executors.newFixedThreadPool(numProcessors);
    log.info("Starting timing of {} tasks in {} threads", callables.size(), numProcessors);
    try {
      List<Future<Void>> futures = executor.invokeAll(callables);
      // Go look for exceptions here, really
      for (Future<Void> future : futures) {
        future.get();
      }
    } catch (InterruptedException ie) {
View Full Code Here

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

            Loader loader = new Loader(emf.createEntityManager());
            tasks.add(loader);
        }
        List<Future<Boolean>> results;
        try {
            results = threads.invokeAll(tasks);
            for (Future<Boolean> result : results) {
                assertTrue(result.get());
            }
        } catch (ExecutionException ee) {
            ee.getCause().printStackTrace();
View Full Code Here

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

        }
        System.out.println("\nInserting " + NUM_TILES_PER_THREAD * numThreads
                + " tiles spread over " + numThreads + " threads.\nConnection pooling: "
                + USE_CONNECTION_POOLING + ". Old style put: " + USE_DELETE_PUT_UNLOCK);

        List<Future<Long>> results = executorService.invokeAll(tasks);

        double totalTime = 0;
        for (Future<Long> result : results) {
            totalTime += result.get().longValue();
        }
View Full Code Here

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

        };
       
        workers.add(rn);
      }

      service.invokeAll(workers);
     
      synchronized (benchmarkParams)
      {
        this.workerResult = workerResult.toArray(new FunctorExecutionMark[0]);
      }
View Full Code Here

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

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(5);

        // submit all tasks
        service.invokeAll(tasks);

        assertMockEndpointsSatisfied();
    }

    @Override
View Full Code Here

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

        mock.expectedBodiesReceived(total);
        mock.expectedHeaderReceived("total", total);
        mock.expectedPropertyReceived(Exchange.AGGREGATED_SIZE, size);

        // submit all tasks
        service.invokeAll(tasks);

        assertMockEndpointsSatisfied();

        assertEquals(100, COUNTER.get());
    }
View Full Code Here

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

                    }
                });
            }

            final ExecutorService executorService = Executors.newFixedThreadPool(10);
            final List<Future<String>> results = executorService.invokeAll(callables);
            final Set<String> replies = new HashSet<String>();
            for (Future<String> future : results) {
                // wait at most 60 sec to not hang test
                String reply = future.get(60, TimeUnit.SECONDS);
                assertTrue(reply.startsWith("Bye "));
View Full Code Here

Examples of java.util.concurrent.ScheduledThreadPoolExecutor.invokeAll()

    // Use a thread pool to execute the Callables in parallel
    List<Future<HdfsBlocksMetadata>> futures =
        new ArrayList<Future<HdfsBlocksMetadata>>();
    ExecutorService executor = new ScheduledThreadPoolExecutor(poolsize);
    try {
      futures = executor.invokeAll(callables, timeout, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
      // Swallow the exception here, because we can return partial results
    }
    executor.shutdown();
   
View Full Code Here

Examples of java.util.concurrent.ScheduledThreadPoolExecutor.invokeAll()

    // Use a thread pool to execute the Callables in parallel
    List<Future<HdfsBlocksMetadata>> futures =
        new ArrayList<Future<HdfsBlocksMetadata>>();
    ExecutorService executor = new ScheduledThreadPoolExecutor(poolsize);
    try {
      futures = executor.invokeAll(callables, timeoutMs,
          TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      // Swallow the exception here, because we can return partial results
    }
    executor.shutdown();
View Full Code Here

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

                        poolSize, poolSize, KEEPALIVETIME, TimeUnit.SECONDS,
                        new LinkedBlockingQueue<Runnable>());

                try {
                    // sample all resources with threadpool
                    final List<Future<HTTPSampleResult>> retExec = exec.invokeAll(liste);
                    // call normal shutdown (wait ending all tasks)
                    exec.shutdown();
                    // put a timeout if tasks couldn't terminate
                    exec.awaitTermination(AWAIT_TERMINATION_TIMEOUT, 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.