/** Stops the processing and prints the final time. */
 @Override
 public void close() {
   logger.info("Finished processing.");
   this.timer.stop();
   this.lastSeconds = (int) (timer.getTotalWallTime() / 1000000000);
   printStatus();
 }
  /**
   * Counts one entity. Every once in a while, the current time is checked so as to print an
   * intermediate report roughly every ten seconds.
   */
  private void countEntity() {
    if (!this.timer.isRunning()) {
      startTimer();
    }

    this.entityCount++;
    if (this.entityCount % 100 == 0) {
      timer.stop();
      int seconds = (int) (timer.getTotalWallTime() / 1000000000);
      if (seconds >= this.lastSeconds + this.reportInterval) {
        this.lastSeconds = seconds;
        printStatus();
        if (this.timeout > 0 && seconds > this.timeout) {
          logger.info("Timeout. Aborting processing.");
          throw new TimeoutException();
        }
      }
      timer.start();
    }
  }