code: public boolean awaitTermination(long timeout, TimeUnit unit)
          throws InterruptedException {
          long nanos = unit.toNanos(timeout);
          final Mutex lock = this.lock;
          lock.lock();
          try {
              for (;;) {
                  if (isTerminated())
                      return true;
                  if (nanos <= 0)
                      return false;
                  nanos = termination.awaitNanos(nanos);
              }
          } finally {
              lock.unlock();
          }
      }
docs: Blocks until all tasks have completed execution after a shutdown
  request, or the timeout occurs, or the current thread is
  interrupted, whichever happens first.
  
  @param timeout the maximum time to wait
  @param unit the time unit of the timeout argument
  @return {@code true} if this executor terminated and
  {@code false} if the timeout elapsed before termination
  @throws InterruptedException if interrupted while waiting