public void cancel(){
  cancelled=true;
  Thread thread=this.thread;
  if (thread != null) {
    thread.interrupt();
  }
}

public void cancel ( ) { cancelled = true ; Thread thread = this . thread ; if ( thread != null ) { thread . interrupt ( ) ; } }
stop execution of the task
