Reputation: 27585
I Have a business in my service that I don't know how long a thread takes time to does its job so I can not set exact interval. Or in another way I want to know how can I set a thread starts after previous one done its job.
Upvotes: 4
Views: 885
Reputation: 27585
You can use DisallowConcurrentExecution
attribute on your jobs. The attribute guaranties that the next execution won't start until the current one get completed.
[DisallowConcurrentExecution]
public class MyJob : IJob {
// whatever your job is
}
For making threads sequentially - that I think you mean job get executed as soon as it get completed - you can use one of these scenarios:
Set your job RepeatForEver
and set interval to a very low number e.g. 10 ms
Set job's repeatation to once, after it get done, schedule a new (same) job
Both will work.
Upvotes: 4