AnsweredAssumed Answered

Timer start event not starting all process instances

Question asked by tushard on Oct 11, 2012
Latest reply on Oct 16, 2012 by jbarrez

I would like to know what happens if a timer start event tries to start a process instance when the number of job executor threads specified by the corePoolSize are exhausted.  I observed that in such a case, the timer start event failed to start a process instance.  I now describe my experiment in detail.

I Created a workflow with timer start event configured as R20/PT1S.  The workflow has a single service task that sleeps for 1 minute in the execute method, then wakes up and prints the current timestamp.  The jobExecutor settings in the activiti.cfg.xml are as follows:
<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.JobExecutor">
    <property name="lockTimeInMillis" value="2700000"/>
    <property name="corePoolSize" value="15"/>
    <property name="maxPoolSize" value="30"/>
When I deployed the workflow, I observed that 15 process instances were created within first 15 seconds.  However, remaining five instances were not started even after the 15 instances previously started finished executing.

I retried this experiment by configuring the timer start event configured as R20/PT10S.  This time, I observed that all 20 instances were successfully started.  It can be seen that by the end of the 150 sec, two of the 15 process instances started initially complete their execution.  So, next two process instances (16 and 17) were started.  By 170 sec, a few other previously started process instances finished executing, so the remaining three process instances (18, 19, and 20) too were started.

Is this the expected behavior of the activiti engine or am I missing something?

Best regards,