Package java.util.concurrent

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


          return fieldMap.getSrcPropertyDescriptor(String.class);
        }
      });
    }

    executorService.invokeAll(callables);
    Thread.sleep(1000);
    executorService.shutdown();
  }

  @Test
View Full Code Here


          assertNotNull(processor);
          return null;
        }
      });
    }
    executorService.invokeAll(callables);
    assertEquals(1, mapper.getCalls());
    assertTrue(exceptions.isEmpty());
  }

  @Test
View Full Code Here

        }
        // Loop until all images are downloaded or timeout is reached
        long totalTimeout = DOWNLOAD_TIMEOUT + DOWNLOAD_TIMEOUT_ONE_TILE * tiles.size();
        log.debug("=== total timeout (millis): {}", totalTimeout);
        ExecutorService service = Executors.newFixedThreadPool(DOWNLOAD_MAX_THREADS);
        List<Future<ImageResult>> futures = service.invokeAll(callables, totalTimeout, TimeUnit.MILLISECONDS);
        // determine the pixel bounds of the mosaic
        Bbox pixelBounds = getPixelBounds(tiles);
        // create the images for the mosaic
        List<RenderedImage> images = new ArrayList<RenderedImage>();
        for (Future<ImageResult> future : futures) {
View Full Code Here

          }
          // Loop until all images are downloaded or timeout is reached
          long totalTimeout = DOWNLOAD_TIMEOUT + DOWNLOAD_TIMEOUT_ONE_TILE * tiles.size();
          log.debug("=== total timeout (millis): {}", totalTimeout);
          ExecutorService service = Executors.newFixedThreadPool(DOWNLOAD_MAX_THREADS);
          List<Future<ImageResult>> futures = service.invokeAll(callables, totalTimeout,
              TimeUnit.MILLISECONDS);
          // determine the pixel bounds of the mosaic
          Bbox pixelBounds = getPixelBounds(tiles);
          int imageWidth = configurationService.getRasterLayerInfo(getLayerId()).getTileWidth();
          int imageHeight = configurationService.getRasterLayerInfo(getLayerId()).getTileHeight();
View Full Code Here

                    String serialized = JsonSerializer.serialize(output, false);
                    return input.equals(serialized);
                }
            });
        }
        List<Future<Boolean>> results = tp.invokeAll(tasks);
        for (Future<Boolean> future : results) {
            Assert.assertTrue(future.get(1, TimeUnit.SECONDS));
        }
        tp.shutdown();
        tp.awaitTermination(10, TimeUnit.SECONDS);
View Full Code Here

            }));
        }

        ExecutorService compressionThreadPool = Executors.newFixedThreadPool(compressionStrategies.size());
        try {
            compressionThreadPool.invokeAll(tasks);
        } catch (InterruptedException ex) {
        } finally {
            compressionThreadPool.shutdown();
        }
View Full Code Here

    });
   
    result="true";
    ExecutorService executor = Executors.newSingleThreadExecutor();
    try {
      executor.invokeAll(callables, timelimit, TimeUnit.MILLISECONDS);
     
    } catch (InterruptedException e) {} finally {
     
      String processName =app_path.substring(app_path.lastIndexOf('/')+1) ;
    if (isProcessRunning(processName)) { killProcess(processName); }
View Full Code Here

    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) {
        if (!future.isDone()) {
          future.get();
        }
View Full Code Here

      String stackHooksToUse = stackExtensionHelper.
              resolveHooksFolder(stack);
      stack.setStackHooksFolder(stackHooksToUse);
    }
   
    es.invokeAll(lookupList);
   
    es.shutdown();
  }

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

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.