Hi Gerhard, thanks a lot for your immediate reply.
I filed the following Jira ticket: https://issues.apache.org/jira/browse/DELTASPIKE-656 Best regards. Robert Am 03.07.14 20:28 schrieb "Gerhard Petracek" unter <[email protected]>: >hi robert, > >please file a jira-ticket, i've a fix for it locally. > >thx & regards, >gerhard > > > >2014-07-03 13:18 GMT+02:00 Bordo, Robert <[email protected]>: > >> Hi All, >> >> When using the Scheduler Module (1.0.0) together with Quartz (2.2.1) and >> start more than one job at the same second, I¹m getting >> ConcurrentModificationExceptions. >> >> This behavior can be reproduced with the following code snippet: >> >> >> package de.rb.sandbox; >> >> >> import javax.enterprise.context.ApplicationScoped; >> >> import javax.enterprise.context.SessionScoped; >> >> >> import org.apache.deltaspike.cdise.api.CdiContainer; >> >> import org.apache.deltaspike.cdise.api.CdiContainerLoader; >> >> import org.apache.deltaspike.cdise.api.ContextControl; >> >> import org.apache.deltaspike.scheduler.api.Scheduled; >> >> import org.junit.After; >> >> import org.junit.Assert; >> >> import org.junit.Before; >> >> import org.junit.Test; >> >> import org.quartz.Job; >> >> import org.quartz.JobExecutionContext; >> >> import org.quartz.JobExecutionException; >> >> >> public class SchedulerTest extends Assert { >> >> >> private CdiContainer cdiContainer; >> >> >> @Before >> >> public void setUp() { >> >> cdiContainer = CdiContainerLoader.getCdiContainer(); >> >> cdiContainer.boot(); >> >> >> ContextControl contextControl = cdiContainer.getContextControl(); >> >> contextControl.startContext(ApplicationScoped.class); >> >> } >> >> >> @After >> >> public void tearDown() { >> >> cdiContainer.shutdown(); >> >> } >> >> >> // runs every second >> >> @Scheduled(cronExpression = "0/1 * * * * ?", startScopes = { >> SessionScoped.class }) >> >> public static class Job1 implements Job { >> >> public void execute(JobExecutionContext context) throws >> JobExecutionException { >> >> System.out.println("Job1"); >> >> >> } >> >> } >> >> >> // runs every 2 seconds >> >> @Scheduled(cronExpression = "0/2 * * * * ?", startScopes = { >> SessionScoped.class }) >> >> public static class Job2 implements Job { >> >> public void execute(JobExecutionContext context) throws >> JobExecutionException { >> >> System.out.println("Job1"); >> >> } >> >> } >> >> >> @Test >> >> public void testIt() throws Exception { >> >> // run for a minute >> >> Thread.sleep(60000); >> >> } >> >> } >> >> Produces something like: >> >> >> Job1 >> >> ERROR 2678 2014-07-03 12:10:42,714 [DefaultQuartzScheduler_Worker-1] >> org.quartz.core.ErrorLogger.schedulerError(2425) - Unable to notify >> JobListener(s) of Job to be executed: (Job will NOT be executed!). >>trigger= >> DEFAULT.6da64b5bd2ee-8e6928dd-89fe-47aa-a620-cb3b80f36aa6 job= >>DEFAULT.Job1 >> >> org.quartz.SchedulerException: JobListener >> >>'org.apache.deltaspike.scheduler.impl.QuartzScheduler$InjectionAwareJobLi >>stener' >> threw exception: null >> >> at >> >>org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzSche >>duler.java:1947) >> ~[quartz-2.2.1.jar:na] >> >> at >> >>org.quartz.core.JobRunShell.notifyListenersBeginning(JobRunShell.java:324 >>) >> [quartz-2.2.1.jar:na] >> >> at org.quartz.core.JobRunShell.run(JobRunShell.java:173) >> [quartz-2.2.1.jar:na] >> >> at >> >>org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java: >>573) >> [quartz-2.2.1.jar:na] >> >> Caused by: java.util.ConcurrentModificationException: null >> >> at java.util.Vector$Itr.checkForComodification(Vector.java:1156) >> ~[na:1.7.0_60] >> >> at java.util.Vector$Itr.next(Vector.java:1133) ~[na:1.7.0_60] >> >> at >> >>org.apache.deltaspike.scheduler.impl.QuartzScheduler$InjectionAwareJobLis >>tener.jobToBeExecuted(QuartzScheduler.java:370) >> ~[deltaspike-scheduler-module-impl-1.0.0.jar:1.0.0] >> >> at >> >>org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzSche >>duler.java:1945) >> ~[quartz-2.2.1.jar:na] >> >> ... 3 common frames omitted >> >> ERROR 2678 2014-07-03 12:10:42,714 [DefaultQuartzScheduler_Worker-2] >> org.quartz.core.ErrorLogger.schedulerError(2425) - Unable to notify >> JobListener(s) of Job to be executed: (Job will NOT be executed!). >>trigger= >> DEFAULT.6da64b5bd2ee-8e6928dd-89fe-47aa-a620-cb3b80f36aa6 job= >>DEFAULT.Job1 >> >> org.quartz.SchedulerException: JobListener >> >>'org.apache.deltaspike.scheduler.impl.QuartzScheduler$InjectionAwareJobLi >>stener' >> threw exception: null >> >> at >> >>org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzSche >>duler.java:1947) >> ~[quartz-2.2.1.jar:na] >> >> at >> >>org.quartz.core.JobRunShell.notifyListenersBeginning(JobRunShell.java:324 >>) >> [quartz-2.2.1.jar:na] >> >> at org.quartz.core.JobRunShell.run(JobRunShell.java:173) >> [quartz-2.2.1.jar:na] >> >> at >> >>org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java: >>573) >> [quartz-2.2.1.jar:na] >> >> Caused by: java.util.ConcurrentModificationException: null >> >> at java.util.Vector$Itr.checkForComodification(Vector.java:1156) >> ~[na:1.7.0_60] >> >> at java.util.Vector$Itr.next(Vector.java:1133) ~[na:1.7.0_60] >> >> at >> >>org.apache.deltaspike.scheduler.impl.QuartzScheduler$InjectionAwareJobLis >>tener.jobToBeExecuted(QuartzScheduler.java:370) >> ~[deltaspike-scheduler-module-impl-1.0.0.jar:1.0.0] >> >> at >> >>org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(QuartzSche >>duler.java:1945) >> ~[quartz-2.2.1.jar:na] >> >> ... 3 common frames omitted >> >> Job1 >> >> >> <and so onŠ> >> >> The only way to omit the concurrency problems is to limit the scheduled >> scope to none: >> >> >> @Scheduled(cronExpression = "0/1 * * * * ?", startScopes = {}) >> >> But this might not be intended. >> >> Could you please help? >> >> Thanks in advance. >> >> Robert >> >>
