SharePoint - Running concurrent custom timer jobs
I've an application where user can schedule custom timer jobs which runs only one time. The problem is that the several timer jobs may exactly开发者_如何学编程 at the same time. In that case, if they try to update a same object (for eg. SPWeb) then I'm facing a problem which gives the following error.
The web being updated was changed by an external process.
When I did some basic search in Google I found this thread which talks about this exception. I understand that this happens when the SPWeb is in a stale state. But timer jobs do not know this.
So is there a way of locking mechanism or some other work around for this issue?
Okay, I've solved the issue. Here is the short and sweet answer -
Create a new object and update it and dispose it immediately (yes, at once)) wherever needed.
Worked well for me when I created a new SPWeb object from the shared object.
精彩评论