AnsweredAssumed Answered

Reassigning & Task Complete race problem

Question asked by shiva.arunachala on Mar 26, 2015
Latest reply on Apr 16, 2015 by shiva.arunachala
i was doing some study on how to make task reassignment and completion fail proof. i tested explorer in below scenario and it failed.
i opened two browers. opened same user task on both browsers. Now did task "reassign" from one browser. and after that task "complete" from another browser. since i reassigned task before clicking on "complete" i expected some kind of error. but no error came. Now as per task service documentation,
void complete(String taskId); 
throws only two exceptions…:

/*@throws ActivitiObjectNotFoundException when no task exists with the given id.
   * @throws ActivitiException when this task is {@link DelegationState#PENDING} delegation.
   */
  void complete(String taskId);

  Now task exists with the given id so no exception was thrown.
My question 1: how can i prevent same situation from appearing in my own application? I have a supervisor who can reassign tasks huge number of tasks.
But if a user has already opened a task, and is working on it, i dont want supervisor to do a reassign on it. (OR) if a supervisor reassigns a task, the origin user should not be able to complete  the task.
question 2: How can i achieve this?

Outcomes