see, rather than using a prefuseaction in a circuit what I tend to do is to 
call a globalpreprocess fuseaction in fusebox.xml.cfm that calls a 
initialise (initialize for you americans) fuseaction, this in turn checks to 
see if the application is initialised and if not then calls a setup 
fuseaction which instantiates the CFCs into the shared scope wrapped in a 
lock.

I believe Sean also does this in his BlogCFC wrapper and seems the neatest 
and cleanest way to do this

And don't forget now with 4.1 you don't need to use the myGlobals plugin, 
just put a file fusebox.init.cfm in the application root and it will be 
included in the fusebox request.

john.

On Apr 8, 2005 8:37 AM, John Beynon <[EMAIL PROTECTED]> wrote:
> 
> which is located at 
> http://www.beynon.org.uk/index.cfm?mode=entry&entry=03672E35-C5D0-F70D-926C2D567BF20686
> 
> john.
> 
> 
> On Apr 7, 2005 7:57 PM, Sean Corfield <[EMAIL PROTECTED]> wrote:
> > 
> > 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:6710
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