Back Forum Reply New

quartz configuration of cron expression problem

hi,

i have a quartz cron problem using spring 2.0-rc3 and quartz 1.5.2.
i configure quartz setting as follows.Code:
lt;bean id=quot;cronTriggerquot; class=quot;org..scheduling.quartz.CronTriggerBeanquot;gt;
lt;property name=quot;jobDetailquot; ref=quot;cronJobquot;/gt;
lt;property name=quot;cronExpressionquot; value=quot;0 00 12 * * ?quot;/gt;
lt;/beangt;

lt;bean class=quot;org..scheduling.quartz.SchedulerFactoryBeanquot;gt;
lt;property name=quot;triggersquot;gt;
lt;listgt;
lt;ref bean=quot;cronTriggerquot;/gt;
lt;/listgt;
lt;/propertygt;
lt;property name=quot;quartzPropertiesquot;gt;
lt;propsgt;
lt;prop key=quot;org.quartz.jobStore.classquot;gt;org.quartz.impl.jdbcjobstore.JobStoreTXlt;/propgt;
lt;prop key=quot;org.quartz.jobStore.tablePrefixquot;gt;QRTZ_lt;/propgt;
lt;prop key=quot;org.quartz.jobStore.driverDelegateClassquot;gt;org.quartz.impl.jdbcjobstore.DB2v8Delegatelt;/propgt;
lt;prop key=quot;org.quartz.dataSource.bg4db.jndiuclquot;gt;jdbc/TESTDBlt;/propgt;     lt;prop key=quot;org.quartz.jobStore.dataSourcequot;gt;testdblt;/propgt;
lt;prop key=quot;org.quartz.jobStore.isClusteredquot;gt;truelt;/propgt;
lt;/propsgt;
lt;/propertygt;
lt;/beangt;
this cron job work fine.
but when i reconfigure cronExpression value like quot;0 00 12 * * ?quot; to quot;0 30 12 * * ?quot; and restart server, this changes is not reflected.
at the first time, cron expression is inserted in the QRTZ_CRON_TRIGGERS table.
but even if i change setting after that, that record is not updated.
why?

regards,
aquaruis

Hello aquaruis

i am not an expert about CronTriggerBean, but i saw this important property that maybe can help you

enter here
sp...api/index.html

go to org..scheduling.quartz  and  next go to Class CronTriggerBean
and look this method  setVolatility

is related with the behavior of cron when the program is  restart

i hope that this help you

best wishes

hi dr_pompeii,

i'm very sorry for late reply.
i try to adding property.Code:
lt;bean id=quot;cronTriggerquot; class=quot;org..scheduling.quartz.CronTriggerBeanquot;gt;
lt;property name=quot;jobDetailquot; ref=quot;cronJobquot;/gt;
lt;property name=quot;cronExpressionquot; value=quot;0 30 12 * * ?quot;/gt;       lt;property name=quot;volatilityquot; value=quot;truequot;/gt;
lt;/beangt;
but QRTZ_CRON_TRIGGERS table is still not updated.

regards,
aquaruis

hi,

this problem is solved by setting quot;overwriteExistingJobsquot; is true on org..scheduling.quartz.SchedulerFac  toryBean's property.Code:
lt;bean class=quot;org..scheduling.quartz.SchedulerFactoryBeanquot;gt;
lt;property name=quot;triggersquot;gt;
lt;listgt;
lt;ref bean=quot;cronTriggerquot;/gt;
lt;/listgt;
lt;/propertygt;       lt;property name=quot;overwriteExistingJobsquot; value=quot;truequot;/gt;
lt;property name=quot;quartzPropertiesquot;gt;
lt;propsgt;
lt;prop key=quot;org.quartz.jobStore.classquot;gt;org.quartz.impl.jdbcjobstore.JobStoreTXlt;/propgt;
lt;prop key=quot;org.quartz.jobStore.tablePrefixquot;gt;QRTZ_lt;/propgt;
lt;prop key=quot;org.quartz.jobStore.driverDelegateClassquot;gt;org.quartz.impl.jdbcjobstore.DB2v8Delegatelt;/propgt;
lt;prop key=quot;org.quartz.dataSource.bg4db.jndiuclquot;gt;jdbc/TESTDBlt;/propgt;     lt;prop key=quot;org.quartz.jobStore.dataSourcequot;gt;testdblt;/propgt;
lt;prop key=quot;org.quartz.jobStore.isClusteredquot;gt;truelt;/propgt;
lt;/propsgt;
lt;/propertygt;
lt;/beangt;
regards,
aquaruis

I am not even using persistent jobs, yet there is some sort of strange memory in the QuartzScheduler that prevents it from picking up changes in the cronExpression. Does it store something in a file?

I even tried setting the quot;overwriteExistingJobsquot; property to true to no avail..Code:
lt;bean class=quot;org..scheduling.quartz.SchedulerFactoryBeanquot;gt;
lt;property name=quot;triggersquot;gt;
lt;listgt;
lt;ref bean=quot;notifyTriggerquot; /gt;
lt;ref bean=quot;cronTriggerquot; /gt;
lt;/listgt;
lt;/propertygt;
lt;property name=quot;overwriteExistingJobsquot; value=quot;truequot;/gt;
lt;/beangt;
lt;bean id=quot;cronTriggerquot;
class=quot;org..scheduling.quartz.CronTriggerBeanquot;gt;
lt;property name=quot;jobDetailquot; ref=quot;ivrBatchJobquot; /gt;

lt;property name=quot;cronExpressionquot; value=quot;0 0 14 45 * ?quot; /gt;
lt;/beangt;
lt;bean name=quot;ivrBatchJobquot;
class=quot;org..scheduling.quartz.JobDetailBeanquot;gt;
lt;property name=quot;jobClassquot;
value=quot;com.mtsallstream.wdfoo.service.IvrBatchJobquot; /gt;
lt;property name=quot;jobDataAsMapquot;gt;
lt;mapgt;
lt;entry key=quot;timeoutquot; value=quot;5quot; /gt;
lt;entry key=quot;ivrDaoquot;gt;
lt;ref bean=quot;ivrDaoquot;/gt;
lt;/entrygt;
lt;entry key=quot;fulfillmentManagerquot;gt;
lt;ref bean=quot;fulfillmentManagerquot; /gt;
lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;
lt;bean id=quot;notifyTriggerquot;
class=quot;org..scheduling.quartz.CronTriggerBeanquot;gt;
lt;property name=quot;jobDetailquot; ref=quot;notifyBatchJobquot; /gt;
lt;property name=quot;cronExpressionquot; value=quot;0 0 14 43 * ?quot; /gt;
lt;/beangt;
lt;bean name=quot;notifyBatchJobquot;
class=quot;org..scheduling.quartz.JobDetailBeanquot;gt;
lt;property name=quot;jobClassquot;
value=quot;com.mtsallstream.wdfoo.service.ConsolidatedNotifyJobquot; /gt;
lt;property name=quot;jobDataAsMapquot;gt;
lt;mapgt;
lt;entry key=quot;timeoutquot; value=quot;5quot; /gt;
lt;entry key=quot;campaignDAOquot;gt;
lt;ref bean=quot;campaignDAOquot;/gt;
lt;/entrygt;
lt;entry key=quot;orderDAOquot;gt;
lt;ref bean=quot;orderDAOquot; /gt;
lt;/entrygt;
lt;/mapgt;
lt;/propertygt;
lt;/beangt;I'm not sure I understand.  So if you change the value in the XML and restart the server the change doesn't work?

Yes, very puzzling...I put a breakpoint at
org..scheduling.quartz.SchedulerFac  toryBean.setTriggers(Trigger[]) line: 409
and find that the cronExpressions in triggers are the older ones.

I'm not sure what the problem was, but likely unrelated to quartz or even spring. I think it might have been MyEclipse debugger.. sorry :-P

(I debugged further and found that the applicationContext being loaded was an old one)

Ooohh well, atleast you've found the problem anyway .  Glad you've got it working!
¥
Back Forum Reply New