Package java.util.concurrent

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


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

      });
    }

    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

    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

        System.gc();
        long beforeFree = Runtime.getRuntime().freeMemory();
        long beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        pool.invokeAll(tasks, 30L, TimeUnit.SECONDS);
        System.gc();
        long afterFree = Runtime.getRuntime().freeMemory();
        long afterTotal = Runtime.getRuntime().totalMemory();

        pool.shutdown();
View Full Code Here

        pool = Executors.newFixedThreadPool(numConcurrency);
        System.gc();
        beforeFree = Runtime.getRuntime().freeMemory();
        beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        pool.invokeAll(tasks, 30L, TimeUnit.SECONDS);
        System.gc();
        afterFree = Runtime.getRuntime().freeMemory();
        afterTotal = Runtime.getRuntime().totalMemory();

        pool.shutdown();
View Full Code Here

        System.gc();
        long beforeFree = Runtime.getRuntime().freeMemory();
        long beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        pool.invokeAll(tasks, 30L, TimeUnit.SECONDS);
        System.gc();
        long afterFree = Runtime.getRuntime().freeMemory();
        long afterTotal = Runtime.getRuntime().totalMemory();

        pool.shutdown();
View Full Code Here

        pool = Executors.newFixedThreadPool(numConcurrency);
        System.gc();
        beforeFree = Runtime.getRuntime().freeMemory();
        beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        pool.invokeAll(tasks, 30L, TimeUnit.SECONDS);
        System.gc();
        afterFree = Runtime.getRuntime().freeMemory();
        afterTotal = Runtime.getRuntime().totalMemory();

        pool.shutdown();
View Full Code Here

        System.gc();
        long beforeFree = Runtime.getRuntime().freeMemory();
        long beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        List<Future<Object>> futures = pool.invokeAll(tasks, 120L, TimeUnit.SECONDS);
        for (Future<Object> future : futures) {
            future.get(30L, TimeUnit.SECONDS);
            assert future.isDone() : "A future failed to complete";
        }
View Full Code Here

        pool = Executors.newFixedThreadPool(numConcurrency);
        System.gc();
        beforeFree = Runtime.getRuntime().freeMemory();
        beforeTotal = Runtime.getRuntime().totalMemory();
        System.gc();
        futures = pool.invokeAll(tasks, 120L, TimeUnit.SECONDS);
        for (Future<Object> future : futures) {
            future.get(30L, TimeUnit.SECONDS);
            assert future.isDone() : "A future failed to complete";
        }
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.