Package java.util.concurrent

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


          }
        }
      });
    }
    // submit them at once
    List<Future<Integer>> results = pool.invokeAll(tasks);

    // check results
    for (Future<Integer> result : results) {
      Assert.assertEquals(0, (int) result.get());
    }
View Full Code Here


      // Resolve hooks folder
      String stackHooksToUse = stackExtensionHelper.resolveHooksFolder(stack);
      stack.setStackHooksFolder(stackHooksToUse);
    }

    es.invokeAll(lookupList);

    es.shutdown();
  }

  /**
 
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

                    }
                });
            }

            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

   */
  public List invokeAll(Collection tasks, long timeout, TimeUnit unit)
      throws InterruptedException {
    ExecutorService service = delegate.get();
    if (service != null) {
      return service.invokeAll(taskManager.trackTasks(tasks), timeout,
          unit);
    }
    throw new RejectedExecutionException(
        "Execution service is terminated. No more tasks can be executed.");
  }
View Full Code Here

   */
  public List invokeAll(Collection tasks)
      throws InterruptedException {
    ExecutorService service = delegate.get();
    if (service != null) {
      return service.invokeAll(taskManager.trackTasks(tasks));
    }
    throw new RejectedExecutionException(
        "Execution service is terminated. No more tasks can be executed.");
  }

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

            TestRunner without = new TestRunner(null,null,datasource.getPoolProperties().getUsername(),datasource.getPoolProperties().getPassword());
            runners[i] = allowUsernameChange?with:without;
            runners[i+withuser] = without;
        }
        ExecutorService svc = Executors.newFixedThreadPool(withuser+withoutuser);
        List<Future<TestResult>> results =  svc.invokeAll(Arrays.asList(runners));
        int failures = 0;
        int total = 0;
        for (int i=0; i<withuser; i++) {
            failures += results.get(i).get().failures;
            total+=results.get(i).get().iterations;
View Full Code Here

    }

    // Call the invokeAll() method
    List<Future<Result>>resultList=null;
    try {
      resultList=executor.invokeAll(taskList);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    // Finish the executor
    executor.shutdown();
View Full Code Here

        MockEndpoint mock = getMockEndpoint("mock:result");
        MockEndpoint mock2 = getMockEndpoint2("mock:result");

        // submit all tasks
        service.invokeAll(tasks);
        service.shutdown();
        service.awaitTermination(10, TimeUnit.SECONDS);

        int contextCount = mock.getReceivedCounter();
        int context2Count = mock2.getReceivedCounter();
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.