[ https://issues.apache.org/jira/browse/DELTASPIKE-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17714566#comment-17714566 ]
Gary Hodgson commented on DELTASPIKE-1449: ------------------------------------------ Hi, we just hit the quartz annotations part of this bug after updating from 1.9.0 to 1.9.6. As Michel states it was introduced in https://github.com/apache/deltaspike/pull/84, if I understand the code correctly, with the introduction of the [JobAdapter|https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/JobAdapter.java] class. This is used by the default org.apache.deltaspike.scheduler.spi.Scheduler: [JobQuartzScheduler|https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/JobQuartzScheduler.java] for the FinalJobClass which in turn the [AbstractQuartzScheduler|https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/AbstractQuartzScheduler.java#L192] uses to specify the JobClass in JobDetail. [org.quartz.impl.JobDetailImpl#isConcurrentExectionDisallowed|https://github.com/quartz-scheduler/quartz/blob/quartz-2.3.x/quartz-core/src/main/java/org/quartz/impl/JobDetailImpl.java#L386] then looks for the DisallowConcurrentExecution annotation on the jobClass to determine if concurrent exection is disallowed: {code:java} public boolean isConcurrentExectionDisallowed() { return ClassUtils.isAnnotationPresent(jobClass, DisallowConcurrentExecution.class); } {code} So far I can't see the use of the JobAdapter class at all, and when I created a simple test JobQuartzScheduler which returns the original class name: {code:java} public class MyJobQuartzScheduler extends AbstractQuartzScheduler<Job> { ... @Override protected Class<? extends Job> createFinalJobClass(Class<? extends Job> jobClass) { return jobClass; } {code} the annotations are found and the regression is gone. > Broken quartz annotations and duplicate job details > --------------------------------------------------- > > Key: DELTASPIKE-1449 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-1449 > Project: DeltaSpike > Issue Type: Bug > Security Level: public(Regular issues) > Components: Scheduler > Affects Versions: 1.9.1 > Reporter: Michel Zedler > Priority: Major > > This exemplary job class > {code:java} > package my.package > import org.apache.deltaspike.scheduler.api.Scheduled; > import org.quartz.DisallowConcurrentExecution; > import org.quartz.Job; > @Scheduled(cronExpression = "...", overrideOnStartup = true) > @DisallowConcurrentExecution > public class MyJob implements Job { > ... > } {code} > using deltaspike 1.9.0 results in: > {noformat} > table: QRTZ_JOB_DETAILS > row 1: > JOB_NAME = MyJob > JOB_CLASS_NAME = my.package.MyJob > IS_NONCONCURRENT = 1 (true){noformat} > using deltaspike 1.9.1 or later > + a previously empty table results in: > {noformat} > table: QRTZ_JOB_DETAILS > row 1: > JOB_NAME = my.package.MyJob > JOB_CLASS_NAME = org.apache.deltaspike.scheduler.impl.JobAdapter > IS_NONCONCURRENT = 0 (false){noformat} > + a non-empty table results in: > {noformat} > table: QRTZ_JOB_DETAILS > row 1: (inserted by a deployment using 1.9.0 or earlier) > JOB_NAME = MyJob > JOB_CLASS_NAME = my.package.MyJob > IS_NONCONCURRENT = 1 (true) > row 2: > JOB_NAME = my.package.MyJob > JOB_CLASS_NAME = org.apache.deltaspike.scheduler.impl.JobAdapter > IS_NONCONCURRENT = 0 (false){noformat} > > I tracked this behaviour down to changes by DELTASPIKE-1369 that were > released with 1.9.1 > causing: > (1) annotations org.quartz.DisallowConcurrentExecution and > org.quartz.PersistJobDataAfterExecution to be effectively ignored because > Quartz checks for their presence in class > org.apache.deltaspike.scheduler.impl.JobAdapter. > (2) consecutive deployments to produce duplicate job details. > I could not find any release notes, migration guides or open bugs or fixes > concerning this topic. > Expected behaviour: > * deltaspike/quartz should update existing JobDetails instead of inserting > duplicates > (JOB_CLASS_NAME of existing job details can be matched to new JOB_NAME - both > are the fully qualified class name) > * functionality of quartz annotations should be restored > I can provide more context if useful. > Are there any known workarounds? > -- This message was sent by Atlassian Jira (v8.20.10#820010)