code: public boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
          if (unit == null) {
              throw new NullPointerException("unit");
          }
  
          final Thread thread = this.thread;
          if (thread == null) {
              throw new IllegalStateException("thread was not started");
          }
          thread.join(unit.toMillis(timeout));
          return !thread.isAlive();
      }
docs: Waits until the worker thread of this executor has no tasks left in its task queue and terminates itself.
  Because a new worker thread will be started again when a new task is submitted, this operation is only useful
  when you want to ensure that the worker thread is terminated <strong>after</strong> your application is shut
  down and there's no chance of submitting a new task afterwards.
  
  @return {@code true} if and only if the worker thread has been terminated