How do I restart an application in ColdFusion?
There are a few answers to this question. ColdFusion will automatically run the onApplicationStart method the first time your application is accessed. You can run the method manually by inserting some code. The following code could be added to your onRequestStart method to allow for a URL variable to re-init the application.
<cfif structKeyExists(url, "reinit")> <cfset onApplicationStart()> </cfif>
It is important to note though that this will not call the method in a single threaded manner. If that doesn't matter, then this provides a simple solution.
Another way to do this would be to set an application timeout of 0 seconds:
<cfset this.applicationtimeout = createTimeSpan(0,0,0,0)>
Hit your application one more time and it will restart. You would then want to reset the timeout back to a good value.
However - in both cases, the active sessions will not be reset.
This question was written by Raymond Camden
It was last updated on September 15, 2006.