Elmo,
I am using MySQL 5.0.18. I am not sure if it is the cause of the problem.
Please find attached the processdefinition I am using. I draw it using
jBPM-Designer and then modify myself.
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="urn:jbpm.org:jpdl-3.1" name="MultipleEvent">
| <start-state name="start">
| <event type="node-enter">
| <action name="startAction"
class="com.multipleevent.action.StartHandler"></action>
| </event>
| <transition name="" to="Location"></transition>
| </start-state>
| <state name="Location">
| <event type="node-enter">
| <action name="locationAction"
class="com.multipleevent.action.LocationHandler"></action>
| </event>
| <transition name="Location-Wait" to="Wait"></transition>
| <transition name="Location-Wait2" to="Wait2"></transition>
| </state>
| <node name="Wait">
| <event type="node-enter">
| <action name="waitAction"
class="com.multipleevent.action.WaitHandler"></action>
| </event>
| <transition name="" to="Process"></transition>
| </node>
| <state name="Process">
| <event type="node-enter">
| <action name="processAction"
class="com.multipleevent.action.ProcessHandler"></action>
| </event>
| </state>
| <node name="Wait2">
| <event type="node-enter">
| <action name="waitAction2"
class="com.multipleevent.action.WaitHandler"></action>
| </event>
| <transition name="Wait2-Process2" to="Process2"></transition>
| </node>
| <state name="Process2">
| <event type="node-enter">
| <action name="processAction2"
class="com.multipleevent.action.ProcessHandler"></action>
| </event>
| </state>
| </process-definition>
|
The main driver is the Location handler, I ask the handler to visit each branch
by creating child tokens, then set the location back to Start, and suspend the
process.
public void execute(ExecutionContext executionContext) throws Exception
{
| Token token =
executionContext.getProcessInstance().getRootToken();
| Token childToken = null;
| ExecutionContext childExecutionContext = null;
|
| childToken = new Token(token, "childToken");
| childExecutionContext = new ExecutionContext(childToken);
|
childExecutionContext.getNode().leave(childExecutionContext,"Location-Wait");
|
| childToken = new Token(token, "childToken2");
| childExecutionContext = new ExecutionContext(childToken);
|
childExecutionContext.getNode().leave(childExecutionContext,"Location-Wait2");
|
|
executionContext.getToken().setNode(executionContext.getProcessDefinition().getNode("start"));
| executionContext.getProcessInstance().suspend();
| }
In main, I write like this (The codes are very messy. I am sorry).
public void run() {
| JbpmConfiguration jbpmConfiguration = null;
| ProcessDefinition processDefinition = null;
|
| JbpmContext jbpmContext = null;
| ProcessInstance processInstance = null;
|
| try {
| jbpmConfiguration = JbpmConfiguration.getInstance();
| processDefinition =
ProcessDefinition.parseXmlResource("MultipleEvent.par/processdefinition.xml");
| jbpmContext = jbpmConfiguration.createJbpmContext();
| jbpmContext.deployProcessDefinition(processDefinition);
| processInstance =
jbpmContext.newProcessInstance("MultipleEvent");
| processInstance.signal();
| jbpmContext.save(processInstance);
| } finally {
| jbpmContext.close();
| }
|
| while (true) {
| jbpmConfiguration = null;
| processDefinition = null;
| jbpmContext = null;
| processInstance = null;
| try {
| jbpmConfiguration =
JbpmConfiguration.getInstance();
| processDefinition =
ProcessDefinition.parseXmlResource("MultipleEvent.par/processdefinition.xml");
| jbpmContext =
jbpmConfiguration.createJbpmContext();
|
jbpmContext.deployProcessDefinition(processDefinition);
| processInstance =
jbpmContext.loadProcessInstanceForUpdate(process_id);
| processInstance.resume();
| processInstance.signal();
| }
| finally {
| jbpmContext.close();
| }
| }
| }
Other Action handlers are just print outs.
When it was running, the JVM was growing slowly. I am not sure if somewhere in
the middle I have done anything wrong causing memory leak.
Thanks.
Philip
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3926671#3926671
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3926671
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user