public static String printStackTrace(Thread t) {
    StringBuilder sb = new StringBuilder();
    for (StackTraceElement frame : t.getStackTrace()) {
      sb.append("\n").append("    ").append(frame.toString());
    }
    return sb.toString();
  }
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