home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / ccs_util.jar / com / commerceone / util / thread / ThreadDump.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-12-09  |  2.2 KB  |  32 lines

  1. package com.commerceone.util.thread;
  2.  
  3. import com.commerceone.util.debug.Debug;
  4.  
  5. public class ThreadDump {
  6.    public static void main(String[] argv) {
  7.       out();
  8.       ThreadGroup tg = new ThreadGroup("Hippie");
  9.       tg.setMaxPriority(7);
  10.       Thread t1 = new 1(tg, "Bosse");
  11.       t1.setPriority(6);
  12.       t1.start();
  13.    }
  14.  
  15.    public static synchronized void out() {
  16.       Thread self = Thread.currentThread();
  17.       int count = Thread.activeCount();
  18.       Thread[] threads = new Thread[count * 2];
  19.       int a_count = Thread.enumerate(threads);
  20.       Debug dbg = Debug.getDefaultInstance();
  21.       dbg.debug("");
  22.       dbg.debug("Current " + self);
  23.       dbg.debug("Active Count=" + count + ", Actual Count=" + a_count);
  24.  
  25.       for(int i = 0; i < a_count; ++i) {
  26.          Thread t = threads[i];
  27.          dbg.debug(t + " alive?=" + t.isAlive() + " daemon?=" + t.isDaemon() + " intptd?=" + t.isInterrupted());
  28.       }
  29.  
  30.    }
  31. }
  32.