tuweni / org.apache.tuweni.concurrent / AsyncCompletion / cancel

cancel

abstract fun cancel(): Boolean (source)

Attempt to cancel execution of this task.

This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run.

After this method returns, subsequent calls to #isDone() will always return true. Subsequent calls to #isCancelled() will always return true if this method returned true.

Return
Boolean: true if this completion transitioned to a cancelled state.