Working with locks on MOSS Timer Jobs
MOSS supports the creation of custom timer jobs. These jobs are of repititive nature and serve the purpose of a scheduled or immediate execution of a task. In cases where the concurrency issue arise you need to attain lock on the code in the Execute() method of the timer class.
The Execute() is invoked when Windows SharePoint Service triggers the execution of the timer job that is installed within MOSS. The timer class Execute() must be modifed with the suggested lock on the code as follows:
public override void Execute(Guid contentDbId)
{
lock (timerLock)
{
// procesing block
}
}
Note: Every executing timer job has a wait time before the excution of it is declared as Failure



Comments
Not sure what this article is about.
Are you trying to talk about locks ? 'Lock' is not specific to MOSS / timers. Lock can be used anywhere you want, to make sure two objects/threads don't access the same resource.
Also, if this is about timers in MOSS,I don't see SPJobDefinition mentioned even once.
Posted by: Nitin | July 3, 2008 5:49 AM