[jBPM Development] - [jBPM4] Behavior of tasks completion when inside two or more
by romain_l-m
Hi everybody,
Here is my problem:
I do not understand the behavior of tasks completion when they are inside two or more forks. You will find the accurate questions in the test case comments.
jBPM is not new for me, and I tried to understand my problem with the documentation and the forum. I am not sure whether this subject is already discussed for jBPM 4. If it is, please could you redirect me to the good thread?
Thanks a lot for your help :)
=== 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=4254030#4254030
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254030
15 years, 3 months
[JBoss OSGi Development] - Re: Autostart bundles when deployed in JBossAS
by thomas.diesler@jboss.com
Here is an update to the issue
I removed the LifecycleCallbackItem and its associated Thread
Instead I use a wrapper around the Deployers that are associated with the MainDeployer
http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runti...
This still relies on implementation detail and I'd like to replace the wrapper with some kind of listener that I can associate with the MainDeployer.
| public OSGiDeployersWrapper(MainDeployer mainDeployer, OSGiBundleManager bundleManager)
| {
| if (bundleManager == null)
| throw new IllegalArgumentException("Null bundleManager");
| if (mainDeployer instanceof MainDeployerImpl == false)
| throw new IllegalStateException("Cannot instrument: " + mainDeployer);
|
| this.mainDeployer = mainDeployer;
| this.bundleManager = bundleManager;
|
| // Swap the deployers implementation
| MainDeployerImpl mainDeployerImpl = (MainDeployerImpl)mainDeployer;
| this.deployers = mainDeployerImpl.getDeployers();
| mainDeployerImpl.setDeployers(this);
| }
|
| public void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
| {
| // Delegate to the original deployers
| deployers.process(deploy, undeploy);
|
| // OSGi bundles resolve phase
| afterDeployersProcess(deploy, undeploy);
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4253629#4253629
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4253629
15 years, 3 months
[JBoss OSGi Development] - Re: Autostart bundles when deployed in JBossAS
by thomas.diesler@jboss.com
To reproduce
#1 Build the installer
mvn -Pdistro clean install
#2 Install MC Framework in jboss-5.2.0 minimal
#3 Delete default bundles
rm -rf server/minimal/deploy/osgi
#4 Start the server
| 12:12:55,287 INFO [OSGiBundleManager] JBossOSGi Runtime - Microcontainer
| 12:12:55,288 INFO [OSGiBundleManager] 1.0.2-SNAPSHOT
| 12:12:55,293 INFO [FrameworkEventsPluginImpl] Bundle STARTING: Bundle{system.bundle:0.0.0}
| 12:12:55,335 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=1 bundle=system.bundle:0.0.0 classes=[org.jboss.osgi.spi.service.MicrocontainerService]}
| 12:12:55,400 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=2 bundle=system.bundle:0.0.0 classes=[org.osgi.service.packageadmin.PackageAdmin]}
| 12:12:55,404 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=3 bundle=system.bundle:0.0.0 classes=[org.osgi.service.startlevel.StartLevel]}
| 12:12:55,407 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{system.bundle:0.0.0}
| 12:12:55,409 INFO [FrameworkEventsPluginImpl] Framwork STARTED
| 12:12:55,664 INFO [ProfileServiceBootstrap] Loading profile: ProfileKey@3c4c33[domain=default, server=default, name=minimal]
| 12:12:55,666 INFO [AbstractServer] Started: JBoss Server[5.2.0.Beta1 (build: SVNTag=JBoss_5_2_0_Beta1 date=200909022330)] in 14s:470ms
|
#5 Deploy Bundle jbosgi142-bundleA.jar
| 12:16:15,779 INFO [FrameworkEventsPluginImpl] Bundle INSTALLED: Bundle{jbosgi142-bundleA:0.0.0}
| 12:16:15,938 INFO [OSGiBundleResolverDeployer] Unresolved: Bundle{jbosgi142-bundleA:0.0.0}
|
#6 Deploy Bundle jbosgi142-bundleX.jar
| 12:16:50,849 INFO [FrameworkEventsPluginImpl] Bundle INSTALLED: Bundle{jbosgi142-bundleX:0.0.0}
| 12:16:50,968 INFO [FrameworkEventsPluginImpl] Bundle RESOLVED: Bundle{jbosgi142-bundleX:0.0.0}
| 12:16:50,973 INFO [FrameworkEventsPluginImpl] Bundle RESOLVED: Bundle{jbosgi142-bundleA:0.0.0}
| 12:16:50,975 INFO [FrameworkEventsPluginImpl] Bundle STARTING: Bundle{jbosgi142-bundleX:0.0.0}
| 12:16:50,975 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{jbosgi142-bundleX:0.0.0}
| 12:16:50,977 INFO [FrameworkEventsPluginImpl] Bundle STARTING: Bundle{jbosgi142-bundleA:0.0.0}
| 12:16:50,988 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{jbosgi142-bundleA:0.0.0}
|
This shows the behaviour with the LifecycleCallbackItem approach.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4253533#4253533
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4253533
15 years, 3 months