7 Replies Latest reply on May 10, 2010 11:03 PM by HuiSheng Xu

    self-transition to node with timer crashes in 4.3

    O S Newbie

      just as the name suggests. used to work in 4.0

      issue is with duplicate entry in the execution DB - seems like the order of DB statement execution isn't right

       

      any ideas of a workaround would be appreciated (adding an interim node and transitioning to it and then back is not desireable)

       

      thanks in advance for ideas,

      gelos

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

       

      modified unit test shipped with 4.3 - TimerTransition

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <process name="TimerTransition" xmlns="http://jbpm.org/4.3/jpdl">

       

        <start g="19,50,48,48">
          <transition to="guardedWait" />
        </start>

       

        <state name="guardedWait" g="98,46,127,52">
          <transition name="go on" to="next step" g="-16,-17"/>
          <transition name="timeout" to="escalation" g="-43,-16">
            <timer duedate="1 hour" />
          </transition>
         
          <transition name="selft" to="guardedWait" />
        </state>
       
        <state name="next step" g="283,46,83,53"/>
        <state name="escalation" g="118,140,88,52" />

       

      </process>

       

       

      public void testTimerTransitionContinueBeforeTimerFires() {
          ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTransition");
         
          String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();

       

          // the next line will crash - duplicate row in the DB

          executionService.signalExecutionById(executionId, "selft");
         
          executionService.signalExecutionById(executionId, "go on");
         
          processInstance = executionService.findProcessInstanceById(processInstance.getId());
         
          assertTrue(processInstance.isActive("next step"));

       

          List<Job> jobs = managementService.createJobQuery()
            .processInstanceId(processInstance.getId())
            .list();
         
          assertEquals(new ArrayList<Job>(), new ArrayList<Job>(jobs));
        }

      }