public synchronized boolean cancel ( ) { if ( this . taskFuture != null && this . taskFuture . cancel ( true ) ) { this . taskStateTracker . onTaskRunCompletion ( this ) ; this . completeShutdown ( ) ; return true ; } else { return false ; } }
return true if the task is successfully cancelled .