How is Spring doing this? By harcoding it on LocalDataSourceJobStore initialize() method
I'm seeing triggers stuck in the ACQUIRED state, or other weird data problems.
Spring defaults the Quartz property "org.quartz.jobStore.dontSetAutoCommitFalse" to "true" - which means Quartz will not turn off auto-commit mode on the database connections that it uses. This is the opposite of Quartz's own default for this setting. If your connection is defaulting to have auto-commit on, then you'll run into all sorts of strange problems relating to data inconsistencies -- the most common symptom being triggers that are "stuck" in the "ACQUIRED" state. Fix this by explicitly setting the property to "false".
As stated on Quartz documentation (see quote above) TRUE is the opposite of the recommendation. And furthermore, because of this, setting Quartz property "org.quartz.jobStore.dontSetAutoCommitFalse" differently does NOT have any effect.
Unfortunately, the fix doesn't seem to be as easy as stated because, as I just mentioned, setting the property to a different value doesn't have any effect since it's being neglected when Spring set's it to TRUE.
So, in order to re-enable this property to allow for configuration I needed to:
1. Override LocalDataSourceJobStore and omit setDontSetAutoCommitFalse(true).
2. Override SchedulerFactoryBean to use my version of LocalDataSourceJobStore. Why? Well, becasue LocalDataSourceJobStore is also harcoded in SchedulerFactoryBean.
3. Override LocalTaskExecutorThreadPool, ResourceLoaderClassLoadHelper, SchedulerAccessorBean, SchedulerAccessor. Why? because they all have static references to one of the components I needed to override.
a. Using Spring's Quartz support out of the box sets org.quartz.jobStore.dontSetAutoCommitFalse to the opposite value recommended by Quartz.
b. It is not possible, using Spring's Quartz out of the box support, to change the property and set it to Quartz recommendation (false).
c. To re-enable this property I need to override 6 Spring components. Note: I did tried to minimize the re-work by extending and override only needed methods but it got very messy quiet fast so I opted for overriding whole classes and just changing the lines and references that needed change.
My questions to the experts:
1. What are the reasons/motivations to harcode setDontSetAutoCommitFalse vs being configurable as is Quartz way?
2. Why is it being set to TRUE which is the opposite of Quartz recommendation?
3. Why is the JobStore also hardcoded to LocalDataSourceJobStore in SchedulerFactoryBean vs being configurable as is Quartz way?
Am I missing something here? Because I find troublesome having to override 6 third party components in order to "re-enable" a property that should be enabled out of the box. I also, at the moment, don't understand why Spring chose to set it to the opposite of Quartz recommendation.
I would really like to hear some opinions and get some answers to the above questions. So, please feel free to comment and if you had gone through the same please drop a few lines sharing your experience and how you got around this issue.