dropwizard-quartz
dropwizard-quartz copied to clipboard
Using @Scheduled with Quartz JDBC job store results in duplicate execution
When @Scheduled
is used on a job class, that class is registered with the scheduler without a job identity or trigger identity. Quartz randomly assigns these ids. When using the JDBC store, ids persist between restarts. On restart, a new random id is assigned resulting in another entry in the DB. This results in the Job being executed multiple times in parallel.
Workaround is not to use the annotation and use scheduler.scheduleJob(jobDetail, trigger)
with JobDetail and Trigger created with static identities. Would be nice if @Scheduled
had the option to set identity.