I try that. If I just cancel the taskinstance, it will go to next node. So I ended the process instance at the same. But the end of process instance does not cancel all task instances.
How could I cancel a taskinstance and stop a process?
if you delete the ProcessInstance, all tasks connected to this one will be gone.
Or u retrieve the TIs with a similar query like that:
// all open tasks private static final String FINDTASKINSTANCES = "select ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where " + " ti.end is null " + " and ti.isCancelled = false";