How do I reset application.cfc without resetting the server instance? [duplicate]
Asked Answered
A

3

5

Possible Duplicate:
restart application without restarting server?

How do I reset a Coldfusion Application / application.cfc without resetting the Coldfusion Server instance? If I remember right, there are a few tricks out there such as creating a reinit function within application.cfc or renaming the file.

Agata answered 14/12, 2009 at 16:58 Comment(0)
C
14

A couple of steps:

First, make sure all your application initialization logic is contained inside the OnApplicationStart method of your CFC. If it has nested calls, that is fine - just so long as you can re-initialize your application easily through a single call makes your life much easier.

Second, this is the code I use in the OnRequestStart method of application.cfc

<cfif structKeyExists(url,'resetappvars')>
  <cfset OnApplicationStart() />
</cfif>

Feel free to use whatever coded value you would like in place of resetAppVars.

Casarez answered 14/12, 2009 at 17:4 Comment(1)
don't forget: <cfcache action="flush">Oxy
O
7

CF9 Doc:

To restart the application, you can stop the application using ApplicationStop() and the next request to any page in this application automatically starts it.

ApplicationStop() is new in ColdFusion 9.

Oxy answered 14/12, 2009 at 19:50 Comment(1)
Wow, that's a handy new feature! :-) Does anyone know if this is in the other CFML engines too?Agata
S
3

If you're on CF8 and using the "if reinit, then call onApplicationStart()" approach, make sure you avoid race conditions. This is a good explanation: http://blog.bullamakanka.net/2009/12/coldfusion-shared-scopes-and-race.html

Soave answered 14/12, 2009 at 21:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.