There isn't much clear info regarding this property on the net. It can be better in terms of performance when the property is set to true, but can cause some headaches if you have set it to true in the wrong scenario.
public bool IsReusable
{
get
{
return false;
}
}
The property is used to indicate if a single intantiation of your IHttpHandler implementation can be used to process multiple concurrent requests. Each client request is considered to be a worker thread on the serverside when being processed through the ASP.NET pipeline. So, if we set IsReusable = true, we need to make sure that our ProcessRequest method is threadsafe. The ProcessRequest should not rely on any state that could be modified by other concurrent request threads. Important when your IHttpHandler implementation does expensive initialisations, otherwise it probabaly doesn't really matter if you return true or false (since simple object allocation is fairly inexpensive in .NET). N.B. Pages are never pooled.
3 comments:
Thanks!! The online docs made no sense, and you cleared it up for me.
Neil, I am confused. It's not clear what IsReusable=true really does. To me it can mean one of two things: a) Pooling: ProcessRequest() still can't be re-entered from another thread while the first one has not finished, but instance is not destroyed after ProcessRequest() is finished, thus saving on the cost of constructing and destructing the instance; and b) Singleton: ProcessRequest() is truly thread-safe, and the same instance's ProcessRequest() can be called by multiple threads without waiting for other threads finishing ProcessRequest(), in which case IHttpHandler instance could behave as a singleton.
From your post is seems you indicate it's scenario B, but is it the case?
米蘭情趣用品我情趣用品我情趣我飛機杯我自慰套我充氣娃娃我AV女優我按摩棒我跳蛋我潤滑液我角色扮演我情趣內衣我自慰器我穿戴蝴蝶我變頻跳蛋我無線跳蛋我電動按摩棒我情趣按摩棒我丁字褲我G點我SM我後庭
視訊美女我視訊做愛
網頁設計
我網頁我設計
Post a Comment