Hey Guys,I wanted to understand this before I create a defect. Recently, I moved to using the SpringJobExecutor and found that I could not shut it down and restart it without booting up the process engine again. Ofcourse, I was experiencing this in my unit tests ( jobExecutor.start() in the setup method and jobExecutor.shutdown() in the teardown method) but wanted to understand the expected behavior./** From SpringJobExecutor **/
@Override
protected void stopExecutingJobs() {
stopJobAcquisitionThread();
taskExecutor = null;
} I believe the developer (Pablo) that worked on https://jira.codehaus.org/browse/ACT-1258 was following the pattern in the DefaultJobExecutor/** From DefaultJobExecutor **/
protected void stopExecutingJobs() {
…
threadPoolExecutor = null;
}But the difference is that the DefaultJobExecutor instantiates a new threadPoolExecutor programmatically in its startExecutingJobs() /** From DefaultJobExecutor **/
protected void startExecutingJobs() {
…
if (threadPoolExecutor==null) {
threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 0L, TimeUnit.MILLISECONDS, threadPoolQueue);
…
}
startJobAcquisitionThread();
}Here are my questions:i) Why are we setting the ThreadPoolExecutor to null in the stopExecutingJobs() method in the DefaultJobExecutor?ii) Considering that there is a good reason for i), does the same reason apply to SpringJobExecutor? I don't like that we are resetting a spring injected taskExecutor to null through code. This is not intuitive and took me some time to get to.iii) I would like the jobExecutor to be working as expected it has been shutdown and started again. I would recommend that we should not set the taskExecutor to null in the stopExecutingJobs() method. Optionally (and less preferably), we could also set a new TaskExecutor in the SpringJobExecutor's startExecutingJobs method. Thoughts?Thanks,Sang