AnsweredAssumed Answered

JobExecutor.waitTimeInMillis being ignored

Question asked by jsilva on Jul 10, 2014
Latest reply on Nov 2, 2015 by vasile.dirla
Hello, everyone.

I'm trying to change the default value for the JobExecutor's waitTimeInMillis property, but my jobs are being retried immediately.

I'm using Activiti 5.15.1 and this is the relevant configuration:

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
    <!– … –>
    <property name="jobExecutor">
       <bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
          <property name="waitTimeInMillis" value="60000" />

I've found that the reason why this happens comes from the code block at org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable:68:

if (jobsAcquired < maxJobsPerAcquisition) {
    // …
} else {
    millisToWait = 0;

So I have three questions:

1. Could someone please explain to me the reason why someone would want a job to execute immediately when the maximum number of jobs has been acquired?

2. What would you suggest to wait before retrying a job? Somehow overriding a FailedJobCommandFactory?

Thanks for your time.