예제 #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");
    }
  }
예제 #2
0
 public Thread newThread(Runnable r) {
   Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
   if (t.isDaemon()) t.setDaemon(false);
   if (t.getPriority() != Thread.NORM_PRIORITY) t.setPriority(Thread.NORM_PRIORITY);
   return t;
 }