How to ensure only one job fires at a time in Quartz.NET? -
i have windows service uses quartz.net execute jobs scheduled. want pick single job @ time. however, seeing behavior indicates has picked 2 jobs @ once.
there 2 log files (the regular 1 , 1 automatically generated when regular 1 in use) jobs start @ exact same time. can see both jobs executing in qrtz_fired_triggers table, 1 has correct instance id, odd.
i have configured quartz use single thread. not how tell pick single job @ time?
here quartz.config file sensitive values hashed out:
quartz.scheduler.instancename = defaultquartzjobscheduler quartz.scheduler.instanceid = ###################### quartz.jobstore.clustered = true quartz.jobstore.clustercheckininterval = 15000 quartz.threadpool.type = quartz.simpl.simplethreadpool, quartz quartz.jobstore.useproperties = false quartz.jobstore.type = quartz.impl.adojobstore.jobstoretx, quartz quartz.jobstore.driverdelegatetype = quartz.impl.adojobstore.oracledelegate, quartz quartz.jobstore.tableprefix = qrtz_ quartz.jobstore.lockhandler.type = quartz.impl.adojobstore.updatelockrowsemaphore, quartz quartz.jobstore.misfirethreshold = 60000 quartz.jobstore.datasource = default quartz.datasource.default.connectionstring = ###################### quartz.datasource.default.provider = oracleclient-20 # customizable values per node quartz.threadpool.threadcount = 1 quartz.threadpool.threadpriority = normal
make threadcount = 1.
<add key="quartz.threadpool.threadcount" value="1"/> <add key="quartz.threadpool.threadpriority" value="normal"/>
(as have done)
make each of jobs "stateful"
[persistjobdataafterexecution] [disallowconcurrentexecution] public class statefuldoesnotrunconcurrentlyjob : ijob /* : istatefuljob */ /* error 43 'quartz.istatefuljob' obsolete: 'use disallowconcurrentexecutionattribute and/or persistjobdataafterexecutionattribute annotations instead. */ { }
i've left in name of ~~older~~ version of how (namely, "istatefuljob") , error message generated when code outdated "istatefuljob" interface. error message gives hint.
basically, if have 1 thread , every job marked "disallowconcurrentexecution", should result in 1 job @ given time..running in "serial mode".
Comments
Post a Comment