5 Replies Latest reply on Sep 3, 2010 2:57 PM by mrbrush

    jBPM 4.4 How do I force a process instance to end

    kevinmoodley

      How do I force a process instance to end?

       

      I have a basic flow with a fork and a join (see attached image).  If one of the forks fails the process instance never ends because the join is never reached.

       

      What is the easiest way to find and force the Process Instance to end in this situation.

       

      Thanks for your help.

      Kevin

      BasicForkAndJoin.png

        • 1. Re: jBPM 4.4 How do I force a process instance to end
          kevinmoodley

          By the way  I tried using

           

          processEngine.getExecutionService().endProcessInstance(instanceId, ProcessInstance.STATE_ENDED);

           

          but this threw a null-pointer exception:

           

          DefaultCommandService - exception while executing command org.jbpm.pvm.internal.cmd.EndProcessInstance@6649
          java.lang.NullPointerException
              at org.jbpm.pvm.internal.util.ReflectUtil.installDeploymentClassLoader(ReflectUtil.java:385)
              at org.jbpm.pvm.internal.util.ReflectUtil.instantiateUserCode(ReflectUtil.java:412)
              at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:63)
              at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:47)
              at org.jbpm.pvm.internal.wire.usercode.UserCodeEventListener.notify(UserCodeEventListener.java:38)
              at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
              at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:672)
              at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:632)
              at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:579)
              at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:568)
              at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:386)
              at org.jbpm.pvm.internal.cmd.EndProcessInstance.execute(EndProcessInstance.java:48)
              at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
              at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
              at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:117)

          • 2. Re: jBPM 4.4 How do I force a process instance to end
            rebody

            Hi Kevin,

             

            Please provide your jpdl.xml and testcase,  it will help us to understand this problem easily,  Thank you very much.

            • 3. Re: jBPM 4.4 How do I force a process instance to end
              yushanyuan

              try this:executionService.deleteProcessInstance(processInstanceId);

              • 4. Re: jBPM 4.4 How do I force a process instance to end
                kevinmoodley

                I am basically using a modified version of your concurrency example (attached) but I make one of the forks take an ERROR transition and then try to force the process instance to end via :

                 

                processEngine.getExecutionService().endProcessInstance(pid,ProcessInstance.STATE_ENDED);

                 

                This works fine unless I have an <on event="end"> on the jPDL. In this case an event is fired, after the process ends,   to handle the on end event. But this results in a null pointer exception because there are no more activities or transitions at this point. UserCodeReference.getProcessDefinition returns null.

                 

                My basic problem is : How do I end a Process Instance if the join is not reached due to an error transition from one of the nodes feeding the join.

                • 5. Re: jBPM 4.4 How do I force a process instance to end
                  mrbrush

                  Hi Kevin,

                   

                  I think this is a bug. I've modified the source of the ReflectUtil class to handle the null case and it works. I've filed an issue in the jBoss JIRA: http://jira.jboss.org/browse/JBPM-2932