how to stop a thread

it seems all stop methods of thread have been deprecated by java. so how to stop a thread then? it is actually simple, just use a boolean variable.

public class Test extends Thread{

  public boolean running= true;

  public void shut(){

    running= false;
} public void run(){ while(running){
/*your method goes here*/
} } }
上一篇:嵌入式Linux启动优化手记2 U…


下一篇:MailKit系列之附件分离