@Override
  protected void beforeExecute(Thread t, Runnable r) {
    super.beforeExecute(t, r);
    pauseLock.lock();
    try {
      while (isStopped) {
        unpaused.await();
      }
    } catch (InterruptedException ie) {
      t.interrupt();
    } finally {
      pauseLock.unlock();
    }
  }
ThreadPoolExecutor extension which is stopped by default and can be started & stopped.
ambari-server/src/main/java/org/apache/ambari/server/utils/ManagedThreadPoolExecutor.java