public void cancel(){
  isCanceled.set(true);
}

public void cancel ( ) { isCanceled . set ( true ) ; }
informs this executor to stop processing and returns any results collected thus far . this method is thread - safe .
