On Apr 7, 2005 11:27 AM, Ali Awan <[EMAIL PROTECTED]> wrote:
> -----myGlobals.cfm----
> <!-- Not sure if I should be locking this.  But I think in MX you don't need
> to.-->

You need to lock for race conditions - which could occur for complex
initializations.

> <cfif NOT StructKeyExists(application,"appInitialized")>
>       <cfset application.appInitialized = 0>
> </cfif>

This is not really very useful. You might just as well test for the
application key directly in the circuit:

> --- circuit.xml.cfm (in the controller folder)----
> <!-- before I define all my fuseactions, here's where I instantiate the
> components only once.  Thereafter in my fuseactions I can <invoke> any of
> these components, as long as I reference them as "application.componentName"
> in the object parameter".
> <prefuseaction>
>             <if condition="application.appInitialized EQ 0">

<if condition="not structKeyExists(application,'appInitialized')">

And you *should* lock the initialization. In fact you really need this:

if not initialized
    lock
        if not initialized
            do the initialization
            set the initialized flag
        /if
    /lock
/if

The if-lock-if is required to avoid race conditions. You can't lock in
circuit.xml without using John Beynon's jb.lock lexicon.
-- 
Sean A Corfield -- http://corfield.org/
Team Fusebox -- http://fusebox.org/
Got Gmail? -- I have 50, yes 50, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6704
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to