Example #1
1
  public static void dumpThreads(ThreadGroup threadGroup, String indent) {
    Thread[] threadList = new Thread[threadGroup.activeCount()];

    threadGroup.enumerate(threadList);

    for (int i = 0; i < threadList.length; i++) {

      Thread t = threadList[i];

      if (t != null) {

        out(
            indent
                .concat("active thread = ")
                .concat(t.toString())
                .concat(", daemon = ")
                .concat(String.valueOf(t.isDaemon())));
      }
    }

    if (threadGroup.getParent() != null) {

      dumpThreads(threadGroup.getParent(), indent + "\t");
    }
  }