在someMethod()中加一个thread,用来判断外面的Thread是否在运行中,
if(false) {return;}
我没试过这个方法,你可以试试!

解决方案 »

  1.   

    但是Thread中断后,someMethod仍在执行。??????
    不会吧?????!!!!!!!!!!!!!!!!!!!
      

  2.   

    方法不行
    还有,这样的线程怎么杀?难道用stop?
      

  3.   

    This method is not implemented.
      

  4.   

    public void interrupt() {
            Thread t = AddHere//your thread.        if (t != null) {
                t.interrupt();
            }
            t = null;
        }
      

  5.   

    interrupt();在此并不能让run()方法停止
      

  6.   

    of course it can, please paste your code below.
      

  7.   

    Thread类中有一个stop()的方法
    此方法能马上终止线程,由于可能产生非预知的结果,所以已经被sun声明废弃---还是可以用的。
      

  8.   

    难道我问错了?
    还是非得用stop?
      

  9.   

    interrupt a thread does not mean kill it . when you interrupt a thread and the thread invoke wait() just now , the thread will get a exception from wait(), so it can stop itself.you can add some wait() in you somemethod() and return at proper moment.
      

  10.   

    somemethod()就像个原子操作,没办法阿