ECM
ECM
总版主
总版主
  • 社区居民
  • 忠实会员
  • 原创写手
阅读:775回复:0

Quartz scheduler: clustering - job executing twice

楼主#
更多 发布于:2016-05-16 10:53
I have a Java application which utilises Quartz 1.6.6. It is deployed onto Weblogic, the architecture of which includes two application servers. The application includes a trigger process which runs regularly - once a minute. This is achieved using Spring 3.1.1 (with a org.springframework.scheduling.quartz.SchedulerFactoryBean). I have included a quartz.properties file in the Java application's EAR file with a hope to be able to utilise Quartz's clustering facilities so that the application servers would synchronise themselves in order that the job is only run once per minute. However, on looking at the application log, it's obvious to see that from the messages produced, there are still two jobs being run every 60 seconds - one a few seconds behind the other. The confusing this is that I have another Java application into which I have included Quartz scheduling and it seems to be working quite happily. This other application has an identical mechanism for firing a trigger every minute and from the logs I can see that the job is only being run once every 60 seconds. Examples of times yesterday afternoon that the job has run: 15:10:46,984 15:10:49,583 15:11:46,961 15:11:49,561 Here's my quartz.properties file: org.quartz.scheduler.instanceName=QuartzClusteredScheduler
org.quartz.scheduler.instanceId=AUTO

org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=5

org.quartz.dataSource.dbDS.driver=oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.dbDS.URL=jdbc:oracle:thin:@MY_DB:1521:my_sid
org.quartz.dataSource.dbDS.user=username
org.quartz.dataSource.dbDS.password=password

org.quartz.dataSource.dbDS.maxConnections=5

org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate

org.quartz.jobStore.isClustered=true
org.quartz.jobStore.dataSource=dbDS
org.quartz.jobStore.tablePrefix=QRTZ_
 I have had a look in the database at the Quartz-specific tables but there is no data at all in them, which would lead me to think that the properties file isn't being picked up for some reason. I can't see why, though, as I have included quartz.properties in the EAR file under WEB-INF/classes in the WAR. Thanks in advance for any assistance.
answer(解决方案):

I have utilised the workaround: include the properties within the SchedulerFactoryBean definition within my application context XML file, instead of using quartz.properties.

 

 

 

 

 

 

 

异常中心网是一家专门收集整理程序员编程过程中遇到的常见异常(exception)以及各种异常问答中心的网站。异常中心网旨在,减少程序员在编码遇到异常,处理各种异常时间和痛苦,让程序员能更愉快的、快速的定位异常并查找对应的异常解决方案。异常中心网诚心打造最完美的编程社区为程序员用户服务,努力成为最好的程序员乐园程序员社区程序异常中心程序bug中心异常问答中心

 

喜欢0 评分0
游客

返回顶部