IHttpHandler.IsReusable

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).
 
A

Anthony Jones

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top