code: private boolean runJobs(int threadCount, List<JobRunner> jobRunners)
        throws InterruptedException, ExecutionException {
      ExecutorService execSvc = Executors.newFixedThreadPool(threadCount);
  
      if ((jobRunners == null) || (jobRunners.size() == 0)) {
        return true;
      }
  
      boolean success = true;
      try {
        List<Future<Boolean>> jobFutures = new LinkedList<Future<Boolean>>();
        for (JobRunner jobRunner : jobRunners) {
          Future<Boolean> jobFuture = execSvc.submit(jobRunner);
          jobFutures.add(jobFuture);
        }
  
        // Wait for all jobs to complete.
        for (Future<Boolean> jobFuture : jobFutures) {
          success = jobFuture.get();
          if (!success) {
            // Stop the presses as soon as we see an error. Note that several
            // other jobs may have already been scheduled. Others will never be
            // scheduled.
            break;
          }
        }
      } finally {
        // Shut down the executor so that the JVM can exit.
        List<Runnable> neverRan = execSvc.shutdownNow();
        if (neverRan != null && neverRan.size() > 0) {
          System.err.println(
              "Interrupted run. Currently running Hadoop jobs will continue unless cancelled. "
                  + neverRan + " jobs never scheduled.");
        }
      }
      return success;
    }
docs: Run the jobs and wait for all of them to complete.
  
  @param threadCount up to how many jobs to run in parallel
  @param jobRunners the list of jobs to run.
  @return whether all jobs completed successfully or not.
  @throws InterruptedException when interrupted while running jobs.
  @throws ExecutionException when at least one of the jobs could not be
  scheduled.