How to delete task instance?

hi,everyone :
we use such java code to add task instance
runtimeService.createProcessInstanceModification(prsInstId)
.startBeforeActivity(tkKey)//会签节点的activityId
.setVariable(“assignee”,userId)
.execute();

but how to delete such instance ?
and how to get the taskId just added ?
can someone tell us ?
thank you in advance