We have an application that uses Quartz to plan work. It uses JDBCJobstore to save work-related metadata.
So far, he has used the data source that was defined in quartz.properties. But in accordance with the upcoming requirement, we plan to derive the data source from quartz.properties and provide it as part of the SchedulerFactoryBean data source property.
org.springframework.scheduling.quartz.SchedulerFactoryBean
According to the SchedulerFactoryBean documentation:
When using persistent jobs, it is highly recommended that you perform all operations with the scheduler as part of Spring-managed (or simple JTA) transactions. Else, a database lock will not work properly and may even break
and the datasource docs document says:
Therefore, it is highly recommended that you perform all operations with the Scheduler as part of Spring-managed (or simple JTA) transactions. Else, a database lock will not work properly and may even break
Well, in my case it breaks. What documentation means exactly means "perform all operations on the scheduler within the framework of Spring-driven (or simple JTA) transactions."
The data source we provided is not used anywhere. Quartz.properties looks something like this:
org.quartz.scheduler.instanceName = JobScheduler
org.quartz.scheduler.instanceId = pcmlScheduler
org.quartz.plugin.shutdownHook.class=org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownHook.cleanShutdown = true
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 2
org.quartz.threadPool.threadPriority = 4
org.quartz.jobStore.misfireThreshold = 5000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.tablePrefix = QRTZ_
if I can get the context of what the transaction refers to, I can add zero to the BreaK database lock:
Failure obtaining db row lock: No row exists in table QRTZ_LOCKS for lock named: TRIGGER_ACCESS [See nested exception: java.sql.SQLException: No row exists in table QRTZ_LOCKS for lock named: TRIGGER_ACCESS]
It is true that QRTZ_LOCKS does not have a single line, but for this, everything should be a quartz headache. And it works great, works great when the data source is provided in quartz.properties.
UPDATE:
, , , , QRTZ_LOCKS .
INSERT INTO QRTZ_LOCKS values('TRIGGER_ACCESS');
INSERT INTO QRTZ_LOCKS values('JOB_ACCESS');
INSERT INTO QRTZ_LOCKS values('CALENDAR_ACCESS');
INSERT INTO QRTZ_LOCKS values('STATE_ACCESS');
INSERT INTO QRTZ_LOCKS values('MISFIRE_ACCESS');
, . , quary.properties . datasource schedulerFactoryBean, (). , , .
- /.