Package java.util.concurrent

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


    }

    int cores = Runtime.getRuntime().availableProcessors();
    log.info("Running on {} cores", cores);
    ExecutorService executor = Executors.newFixedThreadPool(cores);
    List<Future<UserResult>> futures = executor.invokeAll(callables);
    executor.shutdown();

    end = System.currentTimeMillis();
    log.info("Ran recommendations in {}s", (end - start) / 1000);
    start = end;
View Full Code Here


    }

    int cores = Runtime.getRuntime().availableProcessors();
    log.info("Running on {} cores", cores);
    ExecutorService executor = Executors.newFixedThreadPool(cores);
    List<Future<byte[]>> results = executor.invokeAll(callables);
    executor.shutdown();

    end = System.currentTimeMillis();
    log.info("Ran recommendations in {}s", (end - start) / 1000);
    start = end;
View Full Code Here

    callables = wrapWithStatsCallables(callables);
    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);
      //TODO go look for exceptions here, really
      for (Future<Void> future : futures) {
        future.get();
      }
    } catch (InterruptedException ie) {
View Full Code Here

    ExecutorService sinkExecutor = Executors.newFixedThreadPool(10);

    List<Future<Integer>> srcResults = sourceExecutor.invokeAll(sourceList,
        300, TimeUnit.SECONDS);
    Thread.sleep(MockEventUtils.generateSleepInterval(3000));
    List<Future<Integer>> sinkResults = sinkExecutor.invokeAll(sinkList,
        300, TimeUnit.SECONDS);

    int srcCount = 0;
    for (Future<Integer> srcOutput : srcResults) {
      srcCount += srcOutput.get();
View Full Code Here

          return null;
        }
      });
    }

    executor.invokeAll(tasks);
    executor.shutdown();

    return results;
  }
View Full Code Here

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

        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

  }

  static void execute(Collection<Callable<Object>> callables) throws TasteException {
    ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
    try {
      List<Future<Object>> futures = executor.invokeAll(callables);
      int count = 0;
      for (Future<Object> future : futures) {
        future.get();
        if (count++ % 1000 == 0) {
          log.info("Finished {}", count);
View Full Code Here

            }

            ExecutorService executor = Executors.newFixedThreadPool(numThreads);
            long start = System.currentTimeMillis();

            List<Future<Long>> results = executor.invokeAll(clients,
                                                            10, TimeUnit.MINUTES);
            long end = System.currentTimeMillis();
            long count = 0;
            for (Future<Long> r : results) {
                if (!r.isDone()) {
View Full Code Here

                    }
                });
            }

            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

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.