We encounter a problem when using Quartz 2.1.6 with Spring 3.1 in a clustered setup (with a JDBC data store). Current context:
- CRON jobs and triggers are defined in the Spring configuration file (see below).
- The overwriteExistingJobs property is set to true in the SchedulerFactoryBean, so we do not get new job definitions added to the database every time we deploy.
- However, after each deployment in the cluster, it seems that each node re-creates the trigger data. For example, if we have two triggers pointing to 1 task and 4 nodes, then after the cluster is deployed, the database has 1 task definition and 4x2 triggers. Each redeployment adds 4x2 triggers.
Is this normal behavior? If so: how can we tell Quartz not to recreate trigger data with every deployment? (or overwrite this data, as is the case with tasks)
<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="com.etc.MyJob" /> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" p:waitForJobsToCompleteOnShutdown="false" lazy-init="false"> <property name="dataSource" ref="myDataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="overwriteExistingJobs" value="true" /> <property name="autoStartup" value="true" /> <property name="jobFactory"> <bean class="org.springframework.scheduling.quartz.SpringBeanJobFactory"/> </property> <property name="triggers"> <list> <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" p:cronExpression="0 0 0 * * ?" p:misfireInstruction="2"> <property name="jobDetail" ref="myJob" /> </bean> <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean " p:cronExpression="0 0 20 * * ?" p:misfireInstruction="2"> <property name="jobDetail" ref="myJob" /> </bean> </list> </property> <property name="quartzProperties"> <props> <prop key="org.quartz.scheduler.instanceName">fsbu_scheduler</prop> <prop key="org.quartz.scheduler.instanceId">AUTO</prop> <prop key="org.quartz.jobStore.misfireThreshold">60000</prop> <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop> <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.oracle.weblogic.WebLogicOracleDelegate </prop> <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0}LOCKS WHERE SCHED_NAME = {1} AND LOCK_NAME = ? FOR UPDATE </prop> <prop key="org.quartz.jobStore.tablePrefix">fsqrz_</prop> <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> <prop key="org.quartz.jobStore.isClustered">true</prop> <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop> <prop key="org.quartz.threadPool.threadCount">3</prop> <prop key="org.quartz.plugin.triggHistory.class">org.quartz.plugins.history.LoggingTriggerHistoryPlugin </prop> <prop key="org.quartz.plugin.triggHistory.triggerFiredMessage">Trigger {1}.{0} fired job {6}.{5} at {4, date, yyyy-MM-dd HH:mm:ss} </prop> <prop key="org.quartz.plugin.triggHistory.triggerCompleteMessage">Trigger {1}.{0} completed firing job {6}.{5} at {4, date, yyyy-MM-dd HH:mm:ss} with resulting trigger instruction code {9} </prop> </props> </property> </bean>
source share