[jboss-user] [jBPM] New message: "Re: How to terminate a forked process"

Jas Lam do-not-reply at jboss.com
Mon Jan 11 16:42:39 EST 2010


User development,

A new message was posted in the thread "How to terminate a forked process":

http://community.jboss.org/message/519387#519387

Author  : Jas Lam
Profile : http://community.jboss.org/people/lamj1

Message:
--------------------------------------------------------------
These two files below are also attached
 
*Summarize Objective:*
 1) Terminate a parent process that has forked child processes while it is still active
 2) Ensure all child execution are also gracefully ended. 
 3) Any related tasks, and all executions are cleared out from JBPM4_TASK and JPBM4_EXECUTION tables
 
 
*JPDL*
 
<?xml version="1.0" encoding="UTF-8"?>
 
<process name="ForkProcess" xmlns="http://jbpm.org/4.0/jpdl">
 
 <start g="22,69,80,40">
  <transition to="fork"/>
 </start>
 
 <fork g="99,68,80,40" name="fork">
   <on continue="exclusive" event="end"/>
    <transition g="123,45:" to="Processing"/>
    <transition g="124,163:" to="PublishDocument"/>
 </fork>
  
 <task assignee="testUser" g="215,18,121,58" name="Processing">
   <transition g="440,105:-54,-53" name="to join" to="join"/>
 </task>   
   
 <state g="204,138,121,58" name="PublishDocument">
   <transition g="373,162:-53,-21" name="to join" to="join"/>
 </state>
 
  <join g="443,124,80,40" name="join">
    <transition to="wait"/>
  </join>
  
  <state g="575,137,80,40" name="wait">   
   <transition to="end"/>
  </state>
   
  <end g="725,131,48,48" name="end"/>
  
</process>
 
*UnitTest code*
 
package test.ssoa.jbpm.manager;
 
import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.test.JbpmTestCase;
 
public class ForkTest extends JbpmTestCase {
   protected String deploymentFork;
   
   protected void setUp() throws Exception {
     super.setUp();
     
     //add user to database
     identityService.createUser("testUser", "testUser", "testUser", "testUser at test.com");
     
     deploymentFork = repositoryService.createDeployment()
     .addResourceFromClasspath("test/ssoa/jbpm/manager/ForkProcess.jpdl.xml").deploy();     
     
   }
   
   protected void tearDown() throws Exception { 
  //workflowManager.endAll();
  identityService.deleteUser("testUser");
  repositoryService.deleteDeploymentCascade(deploymentFork);    
  super.tearDown();    
   }
 
   public void testForking()
   {
   ProcessInstance processInstance = executionService.startProcessInstanceByKey("ForkSubProcess");
   String pid = processInstance.getId(); 
   
   Execution mainExe = executionService.findExecutionById(pid);   
   
  ((ExecutionImpl)mainExe).end(); //exception here  
   
   }
}
 
Error trace
16:31:14,453 SEV | [BaseJbpmTestCase] 
### EXCEPTION ###########################################
16:31:14,454 SEV | [BaseJbpmTestCase] TEST THROWS EXCEPTION: no environment to get org.jbpm.pvm.internal.session.RepositorySession
org.jbpm.api.JbpmException: no environment to get org.jbpm.pvm.internal.session.RepositorySession
 at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:197)
 at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
 at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:1120)
 at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:373)
 at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:325)
 at test.ssoa.jbpm.manager.ForkTest.testForking(ForkTest.java:36)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at junit.framework.TestCase.runTest(TestCase.java:164)
 at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
### EXCEPTION ###########################################
 
 

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519387#519387




More information about the jboss-user mailing list