4 Replies Latest reply on Feb 24, 2012 3:14 AM by Kiattchai Preecha-anusond

    JBPM stuck when reach AdHocSubprocess and stop executing when reach IntermediateThrowEvent

    Kiattchai Preecha-anusond Newbie

      Hello everyone,

       

      I integrated my application with JBPM5.1Final and found some problem when I try to execute AdHocSubprocess or IntermediateThrowEvent that contain EscalationEventDefinition inside. This is some code from the application.

       

          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

          kbuilder.add(ResourceFactory.newFileResource(new File("test.bpmn2")), ResourceType.BPMN2);

          KnowledgeBase knowledgeBase = kbuilder.newKnowledgeBase();

          StatefulKnowledgeSession kSession = knowledgeBase.newStatefulKnowledgeSession();

          kSession.addEventListener(new ProcessEventListener() {

       

                  @Override

                  public void beforeNodeLeft(ProcessNodeLeftEvent arg0) {

                      System.out.println("left: " + arg0.getNodeInstance().getNode().getName());

                  }

       

                  @Override

                  public void beforeNodeTriggered(ProcessNodeTriggeredEvent arg0) {

                      System.out.println("triggered: " + arg0.getNodeInstance().getNode().getName());

                  }

       

                  ....

       

              });

       

          System.out.println("Start")

          kSession.startProcess("process_1");

          //kSession.startProcess("process_2");

          while (!mKSession.getProcessInstances().isEmpty()) {

              try {

                  Thread.sleep(1000);

              } catch (InterruptedException e) {

                  e.printStackTrace();

              }

          }

          System.out.println("Done")

          kSession.dispose();

       

      Output: process_1

      =====================================

      Start

      triggered: StartEvent

      left: StartEvent

      triggered: AdHoc Subprocess

      =====================================

       

      Output: process_2

      =====================================

      Start

      triggered: StartEvent

      left: StartEvent

      triggered: ThrowEscalation

      Done

      =====================================

       

      It seem that it will struck when found the AdHocSubprocess and stop executing when found the IntermediateThrowEvent. In case of IntermediateThrowEvent, it can execute through to the EndEvent if escalationRef property of EscalationEventDefinition inside the IntermediateThrowEvent is not set. Could anyone suggest me what is the cause of this problem?