IHttpHandler.IsReusable

  • Thread starter Thread starter APA
  • Start date Start date
A

APA

When set to true does this prevent multiple threads from processing this handler simultaneously,i.e. one thread must wait for the completion of the
current thread executing the class before it executes the class? So, if I have 20 requests for this particular handler does each one have to wait
it's turn to execute the class?

If IsReusable is set ot fto alse what is the trade-off (aside from not having to worry about blocking of stepping on the toes of others executing the
same code).
 
APA said:
When set to true does this prevent multiple threads from processing this
handler simultaneously,i.e. one thread must wait for the completion of the
current thread executing the class before it executes the class? So, if I
have 20 requests for this particular handler does each one have to wait
it's turn to execute the class?

If IsReusable is set ot fto alse what is the trade-off (aside from not
having to worry about blocking of stepping on the toes of others executing
the
same code).

IsReusable will causes ASP.NET to pool instances of the handler. Only one
thread will use an instance at any one time. If more than one thread
requires an instance further instances are created.

Its up to you to make sure that any instance level state left in a tidy
state before the end the ProcessRequest method.

It is only useful if some instance level state is expensive to create and is
always the same when a new instance is created.

When ProcessRequest ends the instance is returned to a pool rather than
handed over for GCing.
ASP.NET will reuse existing instances waiting in the pool before creating
additional instances.
 
Back
Top