code: protected final void finish(Thread t) {
      if (t == null) {
        // nothing to terminate
        return;
      }
      try {
        StreamPumper s = null;
        if (t instanceof ThreadWithPumper) {
          s = ((ThreadWithPumper) t).getPumper();
        }
        if (s != null && s.isFinished()) {
          return;
        }
        if (!t.isAlive()) {
          return;
        }
  
        if (s != null && !s.isFinished()) {
          s.stop();
        }
        t.join(JOIN_TIMEOUT);
        while ((s == null || !s.isFinished()) && t.isAlive()) {
          t.interrupt();
          t.join(JOIN_TIMEOUT);
        }
      } catch (InterruptedException e) {
        // ignore
      }
    }
docs: Waits for a thread to finish while trying to make it finish
  quicker by stopping the pumper (if the thread is a {@link
  ThreadWithPumper ThreadWithPumper} instance) or interrupting
  the thread.
  
  @since Ant 1.8.0