code: public synchronized boolean awaitTermination(long milliseconds) 
        throws InterruptedException {
  
      long end = System.currentTimeMillis() + milliseconds;
      for (Map.Entry<String, ThreadPoolExecutor> e:
          executors.entrySet()) {
        ThreadPoolExecutor executor = e.getValue();
        if (!executor.awaitTermination(
            Math.max(end - System.currentTimeMillis(), 0),
            TimeUnit.MILLISECONDS)) {
          LOG.warn("AsyncDiskService awaitTermination timeout.");
          return false;
        }
      }
      LOG.info("All AsyncDiskService threads are terminated.");
      return true;
    }
docs: Wait for the termination of the thread pools.
  
  @param milliseconds  The number of milliseconds to wait
  @return   true if all thread pools are terminated without time limit
  @throws InterruptedException