Hi philsegal, kukeltje and others, I think I misunderstand this topic.
Could you, please, read my process definition and test case ? Sorry for not using assert() correctly, I currently can't remove the println() from my code. The questions I ask are in the test case comments. Thanks in advance for your help. I was not able to find any JIRA information. This forum thread seems to be related to my problem. === Process ================================== | <?xml version="1.0" encoding="UTF-8"?> | <process key="test1" name="test1" xmlns="http://jbpm.org/4.0/jpdl"> | <start name="start1"> | <transition name="to fork1" to="fork1"/> | </start> | <fork name="fork1"> | <transition name="to task1" to="task1"/> | <transition name="to task2" to="task2"/> | </fork> | <task name="task2"> | <transition name="to join2" to="join2"/> | </task> | <task name="task1"> | <transition name="to fork2" to="fork2"/> | </task> | <fork name="fork2"> | <transition name="to task1.1" to="task1.1"/> | <transition name="to task1.2" to="task1.2"/> | </fork> | <taskname="task1.1"> | <transition name="to join1" to="join1"/> | </task> | <task name="task1.2"> | <transition name="to join1" to="join1"/> | </task> | <join name="join1"> | <transition name="to join2" to="join2"/> | </join> | <join name="join2"> | <transition name="to end1" to="end1"/> | </join> | <end name="end1"/> | </process> | === API =================================== | // test case which extends JbpmTestCase | public void testTaskConcurrency() { | repositoryService.createDeployment().addResourceFromClasspath("test1.jpdl.xml").deploy(); | | ProcessInstance processInstance = executionService.startProcessInstanceByKey("test1"); | String processInstanceId = processInstance.getId(); | System.out.println("Process started:"); | for (Task taskTemp : taskService.createTaskQuery().processInstanceId(processInstanceId).list()) { | System.out.println(String.format("> Task '%s' with execution '%s'", taskTemp.getActivityName(), taskTemp.getExecutionId())); | } | /* Output (ok): | * > Task 'task1' with execution 'test1.1.to task1' | * > Task 'task2' with execution 'test1.1.to task2' | */ | | Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).activityName("task1").uniqueResult(); | taskService.completeTask(task.getId()); | System.out.println("task1 completed:"); | for (Task taskTemp : taskService.createTaskQuery().processInstanceId(processInstanceId).list()) { | System.out.println(String.format("> Task '%s' with execution '%s'", taskTemp.getActivityName(), taskTemp.getExecutionId())); | } | /* Output (strange): | * > Task 'task2' with execution 'test1.1.to task2' | * > Task 'task1.1' with execution 'test1.1.to task1.1' | * > Task 'task1.2' with execution 'test1.1.to task1.2' | * > Task 'task1.1' with execution 'test1.1.to task1' | */ | /* Questions: | * Why do I have 2 different 'task1.1' (with different execution id)? | * Which one should I complete? | * Imagine task1 is not a task but a subprocess, this subprocess would be started twice. Is it normal? | */ | | // I cannot use the uniqueResult() method (the task I want to get is not unique) | task = taskService.createTaskQuery().processInstanceId(processInstanceId).activityName("task1.1").list().get(0); | taskService.completeTask(task.getId()); | System.out.println("task1.1 completed:"); | for (Task taskTemp : taskService.createTaskQuery().processInstanceId(processInstanceId).list()) { | System.out.println(String.format("> Task '%s' with execution '%s'", taskTemp.getActivityName(), taskTemp.getExecutionId())); | } | /* Output (still strange): | * > Task 'task2' with execution 'test1.1.to task2' | * > Task 'task1.1' with execution 'test1.1.to task1.1' | * > Task 'task1.2' with execution 'test1.1.to task1.2' | */ | | task = taskService.createTaskQuery().processInstanceId(processInstanceId).activityName("task1.2").uniqueResult(); | taskService.completeTask(task.getId()); | System.out.println("task1.2 completed:"); | for (Task taskTemp : taskService.createTaskQuery().processInstanceId(processInstanceId).list()) { | System.out.println(String.format("> Task '%s' with execution '%s'", taskTemp.getActivityName(), taskTemp.getExecutionId())); | } | /* Output (still strange): | * > Task 'task2' with execution 'test1.1.to task2' | * > Task 'task1.1' with execution 'test1.1.to task1.1' | */ | /* Question: | * I reached the first join, why do I still see the second 'task1.1'? | */ | | task = taskService.createTaskQuery().processInstanceId(processInstanceId).activityName("task2").uniqueResult(); | taskService.completeTask(task.getId()); | System.out.println("task2 completed:"); | for (Task taskTemp : taskService.createTaskQuery().processInstanceId(processInstanceId).list()) { | System.out.println(String.format("> Task '%s' with execution '%s'", taskTemp.getActivityName(), taskTemp.getExecutionId())); | } | /* Output (ok): | * [nothing] | */ | } | === Environment ============================== - jBPM Version : 4.1 - Database : MySQL 5.1 - JDK : 1.6.0_15 - Container : java -version - Configuration : default jbpm.cfg.xml - Libraries : default librairies View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254229#4254229 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254229 _______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
