code: public synchronized boolean waitForFinish() throws Throwable {
      while (!done && exception == null) {
        wait();
      }
      if (exception != null) {
        throw exception;
      }
      return done;
    }
docs: Wait for the task to finish or abort.
  @return did the task finish correctly?
  @throws Throwable