Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a timer job that invokes a WCF service that invokes a single threaded API internally.

TO ensure that my system does not fail, i want to ensure that only a single instance runs at a time.

I am setting SPJobLockType.Job t ensure this.

My concern is, what happens when the timer job schedule is too frequent? What happens when an old instance of the timer job is still running when the new instance is scheduled to run?

Will the new instance of the timer job just defer its execution? or does it abort itself? Or does it abort the old version?

In general, what are the best practices to ensure that my above described scenario runs without any failures?

share|improve this question
    
Have I answered your question? –  Mike Aug 2 '12 at 17:40

2 Answers 2

Jobs that are already running take priority, and new jobs that want to take over will fail. In order to ensure the new job to run, the old job must finish or be aborted.

What does your timer job do exactly? If there are database transactions or file movement, I would say to avoid the abortion of the job if you can help it.

share|improve this answer

The lock type that you have chosen will basically block any other jobs from running until your currently executing job has completed.

So you have two options:

  • Boost the server performance to ensure that your timer job will always finish on time (costly)
  • Choose an appropriate schedule interval to minimise the risk of this type of clash.

It really does depend upon the operation that is being performed by the job and the impact of a scheduled job being missed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.