I am working on a CF9 application, and we have a process that is sometimes required that calls applicationStop()
My understanding of this function is that it shuts down the app, and the app is restarted on next request.
I am using this to reload some application scoped variables and third party stuff, however, it appears as though the onApplicationStart()
function is being called before the onApplicationEnd()
function has finished processing.
Can anyone confirm if this is intended functionality of the applicationStop()
function? The problem it is causing me is that in onApplicationEnd()
I am reseting some application scoped stuff which i want to be re-initialised in onApplicationStart()
, but if it does not wait until onApplicationEnd()
finishes then I get into an inconsistent state.
EDIT The question was originally really more about whether or not it was expected behaviour that onApplicationStart() was being called whilst onApplicationEnd() was still executing, and I was going to fix my problem with using a lock in onApplicationEnd() to make sure it finished its reloading.
However, I have added a lock:
lock scope="application" type="exlusive" timeout="5" {
And it just seems to ignore the whole block - none of the code (logging including) is executed, and no exceptions are thrown (exceptions are thrown if a lock timesout before executing right?). I assume this is related to the fact that we don't really have the complete application scope in the onApplicationEnd()?