源程序不全,不是很快能看懂!
你将ref[i].destroy();前加上 set ref[i] = NULL 看看!

解决方案 »

  1.   

    先加上
    if(ref[i] instanceof Thread)
      ...
    调试一下看看,呵呵~~
      

  2.   

    源程序已经很全了,这个类里面就一个run方法。
    set ref[i] = null 不是java格式。
    设成空自然可以释放内存(ref[i]设成空还怎么invoke那个destroy()方法?!),但是我需要destroy这个线程,我想弄明白的是这个destroy()方法究竟出了什么问题。
      

  3.   

    不好意思,xhh(霹雳游侠),加上你那段话也没用。
    以下放上执行方法:
      public synchronized void set(){
        while(lock == true){
          try{
          wait(1000);
          }
          catch(InterruptedException ie){
            ie.printStackTrace();
          }
        }
        lock = true;
        while(count.length() <50){
          System.out.println("Now In Thread "+ this.getName() + " COUNT's length +1.");
          count +="1";
          System.out.println("Now COUNT value is: "+ count);
          lock = false;
          try{
            wait(1000);
          }
          catch(InterruptedException ie){
            ie.printStackTrace();
          }
          notifyAll();
        }
      }
      public void run(){
        try{
          System.out.println("Now Thread "+ getName() + " is running");
          this.sleep(1000);
          set();
          System.out.println("Now Thread "+ getName() + " is end.");
        }
        catch(InterruptedException ie){
          ie.printStackTrace();
        }
      }
    其中涉及的域:
      private static String count = "";
      private static boolean lock = false;