AnsweredAssumed Answered

Non Recursive Looping and Border Timers Trouble

Question asked by coner on Jul 26, 2011
Latest reply on Jul 29, 2011 by ronald.van.kuijk
activiti 5.6, eclipse plugin

(2 part question)

1:
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)







————————————————————————————————————


2:

Because of the above problem I decided to use exclusive gates to branch back to an earlier part of my application (essentially a loop) but….

start -> print "hello" -> Thread.sleep() -> exclusiveGate (goto Hello) -> exit

I have run into a problem where the branch is apparently a recursive call within the workflow.

Is every step inside of the workflow actually a recursive type call to the next step (aka from start -> hello or hello -> sleep)?  Or are only the branching steps recursive (aka from gate -> hello)?

Furthermore, what is the solution for non-recursive looping without putting the entire workflow into a 3rd party scheduler?


edit:

are any optimizations done on workflows that use the same javaDelegate? or will it re-create the instance of the class within that service task every time it is replicated? -> I am wondering about this because I am trying to test the stack depth limit on activiti.  (I do not know the overhead of the engine's creation of new tasks within the flow)

Outcomes