class T {    public static void test() throws Exception {
        throw new Exception("Hello");
    }    @Override
    protected void finalize() throws Throwable {
        System.out.println(Thread.currentThread().getName()+" Finalize");
    }    public static void main(String[] args) {
        T t = new T();
        try {
            test();
        } catch (Exception e) {
            System.out.println(Thread.currentThread().getName()+" Exception");//异常相关的,肯定是main线程
        }
        t=null;
     //   System.gc();   //垃圾回收相关的
    }
}我是在想,能查看:“Reference Handler优先级:10” 吗?
期待高手

解决方案 »

  1.   


    public class Test{
        public static void main(String[] args) {
            ThreadGroup group = Thread.currentThread().getThreadGroup().getParent();
            group.list();
        }
    }
      

  2.   

    对线程我一向是很生熟的,没有办法,只能帮你top ones!
      

  3.   

    代码:
    public class AllThread { public static Thread[] getAllThread() {
    ThreadGroup root = Thread.currentThread().getThreadGroup();
    ThreadGroup ttg = root;
    while ((ttg = ttg.getParent()) != null) root = ttg;
    Thread[] tlist = new Thread[(int)(root.activeCount() * 1.2)];
    return java.util.Arrays.copyOf(tlist, root.enumerate(tlist, true));
    } public static void main(String[] args) {
    Thread[] ts = getAllThread();
    for (Thread t : ts) {
    System.out.println(t.getId() + ": " + t.getName() + " " + t.getPriority());
    }
    }}
    输出:
    2: Reference Handler 10
    3: Finalizer 8
    4: Signal Dispatcher 9
    5: Attach Listener 5
    1: main 5
      

  4.   

    楼主看你另一贴子:http://topic.csdn.net/u/20081006/15/7915d974-09f8-4bad-9e76-37c138f0eed2.html