3 Replies Latest reply on Dec 2, 2014 5:56 PM by Darren Osten

    how to know where the processInstance stopped

    Domenico Schiavone Newbie

      hi to all,

      I have a simple application that starts 2 times the same process with 2 specific threads.

      The process is formed by: serviceTask-humanTask-humanTask

      Before, the application started the processes in sequence:

                ksession.startProcess("com.sample.bpmn.hello",params);

           ksession2.startProcess("com.sample.bpmn.hello",param);    

       

      and then I was sure that when I make this code:

       

      // let john execute Task 1

              List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");

              int i;

              int r = 2;//numero di volte che si fa partire un processo

              System.out.println(r);

              for(i=0;i<r;i++){

              TaskSummary task = list.get(i);

              System.out.println("questo è il task" + task);

              System.out.println("John is executing task " + task.getName());

              System.out.println(task.getId()+"||"+ task.getProcessInstanceId() +"||"+ task.getActualOwner());

              taskService.start(task.getId(), "john");

              taskService.complete(task.getId(), "john", null);

              System.out.println(task.getStatus());

              }

       

      I was sure that this code was performed only when the second workflow was stopped cause they have met the first humanTask.

      But now I did start the 2 process through 2 threads so that they can start parallel, and now the code for start the human task begins before that the first task ( service task  in this case ) is performed.

      I would know how to do to make the code for human task only after that the workflow was stopped due to have met the human task.

      Is there a way for know this information???