when I tried to fetch pending tasks with executionContext.getTaskMgmtInstance().getTaskInstances()
Try to call setSignaling(false) before call cancel() and it should works.
The problem is that you call "cancel()" in an event (i think) and the token is locked. And calling cancel make the task to signal the token, which is not what you want, and you can't do this from an event.
Another way is to add end-task="true" in the task-node (XML definition).
This will make all tasks not ended to be canceled when the token leave the task-node. So it may not do what you want, because you want to cancel all tasks only when the "reject" transition is taken.