code: public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
          if (unit == null) {
              throw new NullPointerException("unit");
          }
  
          Thread watcherThread = ThreadDeathWatcher.watcherThread;
          if (watcherThread != null) {
              watcherThread.join(unit.toMillis(timeout));
              return !watcherThread.isAlive();
          } else {
              return true;
          }
      }
docs: Waits until the thread of this watcher has no threads to watch and terminates itself.
  Because a new watcher thread will be started again on {@link #watch(Thread, Runnable)},
  this operation is only useful when you want to ensure that the watcher thread is terminated
  <strong>after</strong> your application is shut down and there's no chance of calling
  {@link #watch(Thread, Runnable)} afterwards.
  
  @return {@code true} if and only if the watcher thread has been terminated