cancelFutureOnCancellation

Deprecated

This function does not do what its name implies: it will not cancel the future if just cancel() was called.

Replace with

this.invokeOnCancellation { future.cancel(false) }

Cancels a specified future when this job is cancelled. This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).

invokeOnCancellation { if (it != null) future.cancel(false) }