Problems Starting Shared Async Executor

Dear Flowable experts,

While playing around with SharedExecutorServiceAsyncExecutor, I have stumbled across a suspicious behavior: even though the executor is started, background activities are not executed.

A deeper investigation showed the following implementation of the SharedExecutorServiceAsyncExecutor#start method:

for (String tenantId : timerJobAcquisitionRunnables.keySet()) {
startTimerJobAcquisitionForTenant(tenantId);
startAsyncJobAcquisitionForTenant(tenantId);
startResetExpiredJobsForTenant(tenantId);
}

It somehow functionally differs from that of its parent (AbstractAsyncExecutor). Combining them into a overridden implementation as follows solves the problem:

super.start();
if (isActive) {
return;
}
isActive = true;
log.info(“Starting up the async job executor [{}].”, getClass().getName());
initializeJobEntityManager();
initializeRunnables();
startAdditionalComponents();
executeTemporaryJobs();

Is it anyhow an inconsistency in the code or is it rather me using the executor in an unorthodox way?

Thank you!

Best wishes,
Vasil

Do you mean no async jobs are executed?

Looking at the code, the isActive is the only relevant bit that’s needed, no?
The initializeJobEntityManager() also seems to be needed, but not 100% sure.

Hi Joram,

Yes, that’s right.

This was my first assumption as well. However, setting the flag only brought me to a null pointer exception upon async job execution, as ExecutorService was not instantiated. So, the decision was taken to play it safe and include everything even redundantly.

Ok, looking at the code that makes sense.
I don’t think calling startAdditionalComponents() another time is good (it’ll start a few unused threads). Calling initAsyncJobExecutionThreadPool() instead should be enough.