How to cancel a custom developed batch task

Do you know of any way to Cancel a batch task that you have developed?

I saw that the AbstractFileContentProcessingAutomaticTask interface implements a Cancel member, which according to the documentation should be cancelled when the user requests cancellation manually.

But it looks like this member is not doing anything. When I click Cancel while running a custom developed batch task, I see the Cancelling... message in the UI, then the task just rides out until the end.