[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Running a job every N seconds only if the previous job completed its work  XML
Forum Index -> Quartz
Author Message
robydrup

neo

Joined: 03/10/2010 06:24:37
Messages: 2
Offline

Hi all,
I need to have a single job running every N seconds but only if the previous instance of the same job completed its work. Is that possible to achieve?

Thanks
Roberto
QrtzHelp

journeyman

Joined: 01/16/2010 09:44:00
Messages: 37
Offline


There's no "free" way to achieve this.

But you could do one of the following:

1- use a trigger than repeats every N seconds, have the job unschedule itself if it "fails" (whatever that means to it).
2- use a single-fire simple trigger to fire the job the first time. have the job schedule itself with a new (single-fire) trigger if it "succeeds".
3- a variation of either #1 or #2 where a JobListener does the work of scheduling/unscheduling the job.

robydrup

neo

Joined: 03/10/2010 06:24:37
Messages: 2
Offline

Hi,
thanks for you answer. The problem is slightly different, I don't have to block the next execution if the job fails, but I only need to fire the next execution ONLY if the previous execution completed (I don't care whether it succeed or fails, I just care about running or not).
So what I want to make sure, is not to have to execution at the same time.
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


If all you want to do is prevent concurrent execution, then the simplest solution is to make the job class implement StatefulJob instead of Job.
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team