5 Replies Latest reply on Feb 19, 2008 8:05 AM by mryilauer

    Timer not firing - why ???

    francis1970

      Hi all !
      I have a small process which should fire a timer when the Token has reached a certain Task Node.

      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2"
       name="simpleProcess">
      
       <start-state name="start">
       <transition name="" to="MyTask"></transition>
       </start-state>
      
       <task-node name="MyTask">
      
       <task name="task1">
      
       <timer duedate="20 seconds" repeat="10 seconds">
       <action class="com.sample.action.RemindActor">
       </action>
       </timer>
       <assignment class='com.sample.action.SimpleAssignmentHandler' />
       </task>
       <transition name="node1" to="node1"></transition>
       </task-node>
      
      
       <node name="node1">
      ....
       </node>


      I have looked at the examples which come with Jpdl 3.2.2 distribution and found something like this....

      So I send signal() from the start node, the token moves to MyTask Node but the process doesn't fire the timer alert.
      Why ?
      Thanks for your help!
      Francesco

        • 1. Re: Timer not firing - why ???

          I have the same problem, and I use junit for testing. and I use :

          final int SECONDS_TO_WAIT = 30000; //30 seconds
          try {
          Thread.sleep(SECONDS_TO_WAIT);
          } catch (InterruptedException e) {
          e.printStackTrace();
          }

          to simulate the waiting period. and the expected transition didn't happen. :(

          • 2. Re: Timer not firing - why ???
            francis1970

            Yes, I have tried this too as last option :-)

            Hope somebody can shed some light.....

            • 3. Re: Timer not firing - why ???
              mryilauer

              I am not saying that this is right, but I have a process with a timer, and it fires once, so I attach a handler to it that transitions back to the same node if the condition is not met, so then the timer gets set again.

              • 4. Re: Timer not firing - why ???
                tellierj

                make sure that the JobExecutorThread is started

                • 5. Re: Timer not firing - why ???
                  mryilauer

                  I'm sure not all of this is necessary, but I threw it all at it, and it worked. Whenever I trimmed anything, it didn't. This can't be right, since it seems to create a second timer, but I took care of that in the handler.

                  timer = new Timer(pi.getRootToken());
                  timer.setGraphElement(pi.getRootToken().getNode());
                  timer.setName("programmatic timer");
                  timer.setRepeat("10 seconds");
                  timer.setDueDate(new Date());
                  timer.execute(jbpmContext);
                  jbpmConfiguration.startJobExecutor();