开发者

SharePoint - Running concurrent custom timer jobs

开发者 https://www.devze.com 2023-02-08 23:11 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消