Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

restart application without restarting server?

Tags:

coldfusion

Is there a way to restart a ColdFusion application without restarting the entire server?

There are two ColdFusion applications running on a server and I only want to restart one of them.

like image 576
dmr Avatar asked Jun 25 '10 15:06

dmr


People also ask

How do I reload application properties without restarting server?

include=refresh: this is actuator property which will help us to refresh the properties without restarting the server.

How can I reload my spring boot without having any changes?

5 Answers. Show activity on this post. Add spring-boot-devtools module to your project, which includes LiveReload server which can be used to trigger a browser refresh whenever a resource has been changed. You can download browser extensions from livereload.com.

How do you restart a spring boot server?

Another way to restart our application is to use the built-in RestartEndpoint from Spring Boot Actuator. In the above code, we are using the RestartEndpoint bean to restart our application. This is a nice way of restarting because we only have to call one method that does all the work.


4 Answers

If you are using Application.cfc, you can update it so that you can force a call to onApplicationStart() if something specific is passed in the url, or something similar. Simply place a check for that magic token in onRequestStart(), and call onApplicationStart() if it is.

If you are not, you can try @Marcos's suggestion. I'm not sure what ramifications that may have in your application. What I would suggest is actually renaming your application, so it starts as a new app.

like image 157
Ben Doom Avatar answered Nov 11 '22 10:11

Ben Doom


If you're on CF9, run ApplicationStop() https://cfdocs.org/applicationstop

like image 23
Henry Avatar answered Nov 11 '22 09:11

Henry


Here you go, my CF7/8 version of CF9's ApplicationStop. I believe this is thread safe, noting Sean's comment.

<cffunction name="ApplicationStop" returntype="boolean" output="false">
 <cfif IsDefined('application')>
   <cftry>
     <!--- This is just in case there's no app scope but variables.application --->
     <cfset CreateObject('java', 'coldfusion.runtime.ApplicationScopeTracker').cleanUp(application) />
     <cfreturn true />
     <cfcatch type="any"></cfcatch>
   </cftry>
 </cfif>
 <cfreturn false />
</cffunction>

As mentioned by Henry, he's my blog post on the subject: http://misterdai.wordpress.com/2010/06/14/cf-flag-application-to-run-onapplicationstart-part-2/

like image 28
Mister Dai Avatar answered Nov 11 '22 10:11

Mister Dai


A less invasive way of ending your app is to temporarily set the ApplicationTimeout to something very short.

Here is an example from an application.cfc file where the app is set to timeout in 10 seconds, which is plenty short for making a change and then checking back:

<cfcomponent displayname="Application">
    <cfscript>
        this.name = "myAppName";
        this.setclientcookies="yes";
        this.sessionmanagement="yes";
        this.sessiontimeout= CreateTimeSpan(0,0,60,0);
        this.applicationTimeout= CreateTimeSpan(0,0,0,10);
    </cfscript>
    ...
</cfcomponent>

You might need to limit the session, too. See this article by Ben Nadel for an in-depth look at Application and Session timeouts.

like image 44
gkl Avatar answered Nov 11 '22 09:11

gkl