This content has been marked as final. Show 7 replies
Why do you need to restart only 1 application?
> I would like to find a way to restart just one of the applications that I have
> running on my server with out having to restart coldfusion. Restarting
> coldfusion would restart all of the application running.
What do you mean by "single application"? An individual web site
doesn't really start or stop. Are you just trying to reset global
variables? Are you talking about different instances of ColdFusion in a
mulit-home configuration? I'm not clear what you are looking for.
In short I need to reset all of my application scope variables. This only happens in onApplicationStart in the application.cfc.
What I do is create a seperate function called SetAppVars in my Application.cfc. The OnApplicationStart function calls it, but I also put a conditional in the OnRequestStart function that calls the same function if I pass in a specific URL variable. Hope that helps!
> In short I need to reset all of my application scope variables. This only happens in onApplicationStart in the application.cfc.
Another way you can do it, if you just want to do it once in while, is
temporarily set the application timeout to a few seconds or even zero.
Then run the app, then restore the application timeout. Not as robust
as the previous conditional suggestion, but sometimes one wants to test
how an app behaves when it is accessed for the first time and this
Can't you also call the onApplicationStart() function from a regular coldfusion page? I remember reading in the docs about being able to call the onSessionStart() function, but it didn't mention anything about the onApplicationStart() function.
> Can't you also call the onApplicationStart() function from a regular coldfusion
> page? I remember reading in the docs about being able to call the
> onSessionStart() function, but it didn't mention anything about the
> onApplicationStart() function.
Yes you can, the only caveat is to be careful how the function is
written. When it is called automatically during the start of an
application all application variables are appropriately locked. If
called at any other time the automatic locking does not occur. So be
aware of potential race conditions and code appropriately.