When I update my data dictionary, which is done from the Web application, the next hit will know about it and will wait 2.5 seconds, just so to assure that all ongoing hits can be completed, before reinitializing the oApp global application object, which is visible to each multi threaded instance of each application pool. This includes a locking mechanism just so to assure that only one hit will initialize the oApp global application object.
But, when the application pool recycles the application, I have faced a situation that my oApp was no longer visible for a fraction of a second for another hit which had just started a fraction of a second before the other hit from the multi threaded worker process recycles. So, basically, to rectify the situation, on my Global.vb, which handles the code on recycle, I should add a 2.5 seconds timeout to do the same. So, when the Application_End event will fire, if this is a recycle, the timeout will allow enough time for other hits in progress to finish before releasing the oApp object. Then, the next hit will fall into the regular initialization as if I would have sent a new compile.
This seems to make sense. I am just wondering if I need to implement any locking mechanism at the Application_End event.