cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti Border Timer Events

coner
Champ in-the-making
Champ in-the-making
Activiti 5.6, Eclipse Plugin

I have been having trouble creating border timer events successfully.

My model is a simple diagram with 2 service tasks, they only have System.out.println's inside of them.

I have been trying to setup the diagram such that the first event executes, and if it takes > 3 seconds to complete, the second task will also execute.  Then the program will end.

Start -> Print Hello -> Exit
            Timer:LimitExceeded
            Print Slow Process -> Exit

this example is nearly identical to the one in the userguide except i am using PT4S instead of PT4H.  I have been testing the timer by using Thread.sleep() in the first service task.

Also <property name="jobExecutorActivate" value="true" /> is in the activiti.cfg.xml file.

the error that appears is:

Jul 21, 2011 5:48:15 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
   at org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler.execute(TimerExecuteNestedActivityJobHandler.java:39)
   at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:78)
   at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:62)
   at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:58)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:36)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception in thread "pool-1-thread-6" java.lang.NullPointerException
   at org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler.execute(TimerExecuteNestedActivityJobHandler.java:39)
   at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:78)
   at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:62)
   at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:58)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:36)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
5 REPLIES 5

coner
Champ in-the-making
Champ in-the-making
so i've had to resort to using the following model to allow for timing:

start -> doWork -> sleep() -> exclusiveGate -> exit
               ^———————–|

where the exclusiveGate will always select the branch to go back to the doWork serviceTask.

mathiasd
Champ in-the-making
Champ in-the-making
Up !
I don't understand your solution. I'm having the same problem, I think I misunderstood the boundary timer event :

Start-event -> Script task containing a telnet request -> End-event

I put the following boundary event :

<boundaryEvent attachedToRef="telnetTask" cancelActivity="true" id="timer">
         <timerEventDefinition id="_theTimer">
            <timeDuration id="_theTimerDuration" xsi:type="tFormalExpression">PT1S</timeDuration>
         </timerEventDefinition>
      </boundaryEvent>

This boundary event is linked with a simple script task which print "Timeout", then it goes on an end-event.
My fake-telnet-server send a response 5 seconds after it receives the request, so the workflow should go in "Timeout" no ?

Instead of printing "Timeout", the workflow ends normally (after 5 seconds) then it prints :

GRAVE: Error while closing command context
java.lang.NullPointerException
at org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler.execute(TimerExecuteNestedActivityJobHandler.java:39)
at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:78)
at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:62)
at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:58)
        …

What's wrong here ?

EDIT :

Actually now it writes "Timeout" after 1 second, but still got the nullPointerException. Plus, if I put a while(true); in my script, the timer doesn't work anymore (the flow gets stucked in the script task).

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Wrong forum…

mathiasd
Champ in-the-making
Champ in-the-making
Could someone moves this subject to the right forum ?

mathiasd
Champ in-the-making
Champ in-the-making