« Silverlight - CheckBox issue when in ListBox | Main | Silverlight - Are you missing WatermarkedTextBox? »

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

TrackBack

TrackBack URL for this entry:
http://www.infosysblogs.com/apps/mt-tb.cgi/1844

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.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter