code: public List<Future<T>> execute() throws InterruptedException {
  
      List<Future<T>> futures = Lists.newArrayList();
  
      try {
        if (this.executed) {
          throw new RuntimeException(String.format("This %s has already been executed.", IteratorExecutor.class.getSimpleName()));
        }
  
        int activeTasks = 0;
        while (this.iterator.hasNext()) {
          try {
            futures.add(this.completionService.submit(this.iterator.next()));
            activeTasks++;
          } catch (Exception exception) {
            // if this.iterator.next fails, add an immediate fail future
            futures.add(Futures.<T>immediateFailedFuture(exception));
          }
          if (activeTasks == this.numThreads) {
            this.completionService.take();
            activeTasks--;
          }
        }
        while (activeTasks > 0) {
          this.completionService.take();
          activeTasks--;
        }
      } finally {
        ExecutorsUtils.shutdownExecutorService(this.executor, Optional.of(log), 10, TimeUnit.SECONDS);
        this.executed = true;
      }
  
      return futures;
    }
docs: Execute the tasks in the task {@link Iterator}. Blocks until all tasks are completed.
  
  <p>
  Note: this method only guarantees tasks have finished, not that they have finished successfully. It is the caller's
  responsibility to verify the returned futures are successful. Also see {@link #executeAndGetResults()} for different
  semantics.
  </p>
  
  @return a list of completed futures.
  @throws InterruptedException