views:

280

answers:

2

I am currently implementing Quartz.net in a simple application that should execute a piece of code every (for example) 5 seconds. Only now the code sometimes takes more than 5 seconds to complete.

At first I had the problem that the code was executed while the same code was still running, I fixed this by using the IStateFulJob interface instead of the IJob interface.

But what I would really like to accomplish is, that my job is executed 5 seconds AFTER the job is completed, not 5 seconds after my previous job is started.

I ofcourse could handle the event which is triggered when my listener 'hears' that the job is ready and re-schedule the job, but I was wondering if there isn't any standard functionality for this.

+1  A: 

Currently there is no standard way to achieve this as Quartz.NET plays on the idea to have a predefined (calculated beforehand) fire time and polling for right time to trigger the work.

The way you described would be the easiest path. Either schedule from the the job the next execution or from the listener.

Marko Lahma
A: 

were you able to accomplish this? how, with a listener? Thank You

quimbo
I did it like I described in my question.
Wim Haanstra