Hi,
I have simple config with timer start event, from config below I expect that my thread pool will have const size “2” but during tests I see threads creations( which confirm from logs, where I print thread name), what I’m doing wrong, why these threads did not reuse
start Fri Apr 23 09:53:33 CEST 2021 flowable-async-job-executor-thread-1
stop Fri Apr 23 09:53:34 CEST 2021 flowable-async-job-executor-thread-1
start Fri Apr 23 09:54:02 CEST 2021 flowable-async-job-executor-thread-3
stop Fri Apr 23 09:54:03 CEST 2021 flowable-async-job-executor-thread-3
start Fri Apr 23 09:54:32 CEST 2021 flowable-async-job-executor-thread-5
stop Fri Apr 23 09:54:33 CEST 2021 flowable-async-job-executor-thread-5
start Fri Apr 23 09:55:03 CEST 2021 flowable-async-job-executor-thread-7
stop Fri Apr 23 09:55:04 CEST 2021 flowable-async-job-executor-thread-7
start Fri Apr 23 09:55:33 CEST 2021 flowable-async-job-executor-thread-9
stop Fri Apr 23 09:55:34 CEST 2021 flowable-async-job-executor-thread-9
start Fri Apr 23 09:56:03 CEST 2021 flowable-async-job-executor-thread-11
stop Fri Apr 23 09:56:04 CEST 2021 flowable-async-job-executor-thread-11
start Fri Apr 23 09:56:33 CEST 2021 flowable-async-job-executor-thread-13
stop Fri Apr 23 09:56:34 CEST 2021 flowable-async-job-executor-thread-13
config:
StandaloneProcessEngineConfiguration standaloneProcessEngineConfiguration = new StandaloneProcessEngineConfiguration();
standaloneProcessEngineConfiguration.setAsyncExecutorMaxPoolSize(2);
standaloneProcessEngineConfiguration.setAsyncExecutorCorePoolSize(2);
standaloneProcessEngineConfiguration.setAsyncExecutorDefaultTimerJobAcquireWaitTime(5000);
ProcessEngineConfiguration cfg = standaloneProcessEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=-1")
.setJdbcUsername("sa").setJdbcPassword("").setJdbcDriver("org.h2.Driver")
.setDatabaseSchemaUpdate(AbstractEngineConfiguration.DB_SCHEMA_UPDATE_DROP_CREATE);
cfg.setAsyncExecutorActivate(true);
ProcessEngine processEngine = cfg.setHistory(HistoryLevel.FULL.getKey()).setAsyncExecutorActivate(true).buildProcessEngine();
processEngine.getRepositoryService().createDeployment().addClasspathResource("business-tx-timer.bpmn20.xml").deploy();
where business-tx-timer.bpmn20.xml:
<process id="timer">
<startEvent id="theStart" flowable:async="true">
<timerEventDefinition>
<timeCycle>*/30 * * * * ?</timeCycle>
</timerEventDefinition>
</startEvent>
<sequenceFlow sourceRef="theStart" targetRef="script" />
<scriptTask id="script" name="Execute script2"
scriptFormat="groovy" flowable:async="true">
<script>
println 'start '+new Date()+' '+Thread.currentThread().getName()
Thread.sleep(1000)
println 'stop '+new Date()+' '+ Thread.currentThread().getName()
</script>
</scriptTask>
<sequenceFlow sourceRef="script" targetRef="finalend" />
<endEvent id="finalend" />
</process>