I've a job in Quartz.Net which triggers quite frequently, and sometimes runs for long, how do i cancel the trigger if the job is already running?
+1
A:
Could you not just set some sort of global variable (jobRunning=true) when the job starts and revert it to false once it's finished?
Then when the trigger fires, just run your code if(jobRunning==false)
Paul
2009-09-10 13:40:40
yes, often the simplest solutions are the best. i've implemented this, i though there were a implemented solution for this which paused the job until the first is done, but whatever, this works just fine!
Carl Hörberg
2009-09-10 14:38:45
A:
Your app could remove itself from the job list on startup and insert itself on shutdown.
Austin Salonen
2009-09-10 14:34:46
+1
A:
The more standard way is to use IInterruptableJob, see http://quartznet.sourceforge.net/faq.html#howtostopjob . Of course this is just another way to say if (!jobRunning)...
Marko Lahma
2009-09-12 13:03:53
is only one instance of that class which implements IInterruptableJob allowed at a time, or a Job which uses that class?
Carl Hörberg
2009-09-15 08:49:36
If you want to allow only one instance at a time then IStatefulJob is your fried, http://quartznet.sourceforge.net/faq.html#howtopreventconcurrentfire . IInterruptableJob just gives you a standard way to signal interrupt and you need to do the heavy-lifting on the job side (check if interrupted flag has been raised).
Marko Lahma
2009-09-15 13:27:23