Examples of invokeAll()


Examples of java.util.concurrent.ExecutorService.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.ExecutorService.invokeAll()

                        }
                    }
                });
            }
            try {
                List<Future<Boolean>> futures = service.invokeAll(tasks);
                for(Future<Boolean> future: futures) {
                    assertTrue(future.get());
                }
            } catch(Exception e) {
                fail("Unexpected exception - " + e.getMessage());
View Full Code Here

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

        }
      });
    }

    try {
      es.invokeAll(tasks);
      es.shutdown();
    } catch (InterruptedException e) {
      throw new RuntimeException("Impossible error");
    }
View Full Code Here

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

      callables.add(callable);
    }

    List<Future<IStatus>> futures = null;
    try {
      futures = threadPool.invokeAll(callables);
      threadPool.shutdownNow();
      long endTime = System.currentTimeMillis();
      long timeInSec = (endTime - startTime) / 1000;
      long sec = timeInSec % 60;
      long min = (timeInSec - sec) / 60;
View Full Code Here

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

   
    ExecutorService executor = Executors.newFixedThreadPool(count);
   
    try
    {
      List<Future<SimpleObject>> futures = executor.invokeAll(tasks);
     
      for (Future<SimpleObject> future: futures)
      {
        ExecutionException exception = null;
       
View Full Code Here

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

   
    ExecutorService executor = Executors.newFixedThreadPool(count);
   
    try
    {
      List<Future<SimpleObject>> futures = executor.invokeAll(tasks);
     
      int fail = 0;
     
      // Only 1 of these will succeed, the rest will timeout.
      for (Future<SimpleObject> future: futures)
View Full Code Here

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

      }
 
      Assert.assertEquals(count - 1, fail);
     
      // All should succeed now
      List<Future<SimpleObject>> moreFutures = executor.invokeAll(tasks);
     
      for (Future<SimpleObject> future: moreFutures)
      {
        Exception exception = null;
        try
View Full Code Here

Examples of java.util.concurrent.ExecutorService.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.ExecutorService.invokeAll()

      });
    }

    ExecutorService exec = Executors.newFixedThreadPool(fileCount);
    try {
      List<Future<Boolean>> futures = exec.invokeAll(tasks);
      // files should be public
      for (Future<Boolean> future: futures) {
        assertTrue(future.get());
      }
      // for each path exactly one file status call should be made
View Full Code Here

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

    NodeRunner node1 = new NodeRunner(js1);
    NodeRunner node2 = new NodeRunner(js2);
    String[] output1 = null, output2 = null;
    try {
      // set the timeout to maxASTSize milliseconds
      List<Future<String[]>>  futures = executor.invokeAll(
          Lists.newArrayList(node1, node2), maxASTSize, TimeUnit.MILLISECONDS);

      Future<String[]> future1 = futures.get(0);
      if (!future1.isCancelled()) {
        output1 = future1.get();
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.