public static boolean isNonDaemonThreadRunning() {
    AtomicInteger nonDaemonThreadCount = new AtomicInteger();
    Set<Thread> threads = Thread.getAllStackTraces().keySet();
    threads.forEach(t -> {
      // Exclude current thread
      if (t.getId() != Thread.currentThread().getId() && !t.isDaemon()) {
        nonDaemonThreadCount.getAndIncrement();
        LOG.info("Non daemon thread {} is still alive", t.getName());
        LOG.info(printStackTrace(t));
      }
    });
    return nonDaemonThreadCount.get() > 0;
  }
Checks whether any non-daemon thread is running.
@return true if there are non daemon threads running, otherwise false
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Threads.java