J
Jordan S.
Using .NET 3.5...
1. Will ASP.NET guarantee that no more than ONE instance of a custom HTTP
handler factory (class implementing IHttpHandlerFactory) is ever created in
an ASP.NET application?
2. Assuming the answer to #1 is "yes - never more than one instance" (I hope
that's true), then does ASP.NET automatically take care of concurrency with
respect to accessing that one instance?
My situation is that I have written a custom handler factory. In it's
constructor, I initialize a couple of class-scoped collections that are
subsequently used by logic called by the factory's GetHandler() method.
I am concerned that when the app is restarted (for whatever reason), and if
the site is really busy, multiple requests could arrive simultaneously (or
close enough to cause concurrency problems) while my custom factory is
initializing itself. Is there anything I can or should do to avoid race
conditions or other such concurrency problems - or will ASP.NET queue the
requests until the factory is ready to serve all of the queued requests?
I have observed that my custom factory is not instantiated until the first
request arrives (after an IIS or application restart)... thus my concern -
what if 100 requests arrive all at once and the factory isn't yet
instantiated and initialized?
Thanks.
1. Will ASP.NET guarantee that no more than ONE instance of a custom HTTP
handler factory (class implementing IHttpHandlerFactory) is ever created in
an ASP.NET application?
2. Assuming the answer to #1 is "yes - never more than one instance" (I hope
that's true), then does ASP.NET automatically take care of concurrency with
respect to accessing that one instance?
My situation is that I have written a custom handler factory. In it's
constructor, I initialize a couple of class-scoped collections that are
subsequently used by logic called by the factory's GetHandler() method.
I am concerned that when the app is restarted (for whatever reason), and if
the site is really busy, multiple requests could arrive simultaneously (or
close enough to cause concurrency problems) while my custom factory is
initializing itself. Is there anything I can or should do to avoid race
conditions or other such concurrency problems - or will ASP.NET queue the
requests until the factory is ready to serve all of the queued requests?
I have observed that my custom factory is not instantiated until the first
request arrives (after an IIS or application restart)... thus my concern -
what if 100 requests arrive all at once and the factory isn't yet
instantiated and initialized?
Thanks.