ColdFusion can execute code when an application starts and ends, when a session starts and ends, when a request starts and ends, and more. But what if you need to execute code when a server starts up? Granted, this is not a common use case, but when needed, we’ve had to use onApplicationStart for this, probably doing something like:

...

ColdFusion Centaur adds the ability to define code to be executed onServerStart.
By default this is a method named onServerStart in server.cfc. But, actually, it can be in any ColdFusion Component, including an Application.cfc. In ColdFusion Administrator you can point to the CFC and method to be invoked, and ColdFusion will execute the code on server start-up before processing any requests.

5 thoughts

  1. This release is shaping up to have some nifty features. Good on Adobe for implementing features that, you know, matter to developers.

  2. I suggest, create a CFML tamplate. Add a IF condition, if there is no defined "application.check" then run the code. Add this page to Scheduled Tasks ind ColdFusion. Schedule increment is 10sn
    Simple and effectivly.

  3. Ben! Don’t downplay the benefits and power of onServerStart. A lot of apps take an initial hit on the first request while all of the onApplicationStart initialization runs. onServerStart is the perfect opportunity to initialize all of the apps on the server and get the first-serve overhead out of the way so the first user doesn’t feel it. It’s Michael Jackson bad.

Leave a Reply