I do use that approach, but one has to be aware of the risks.  If you're in
the habit of writing links using the existing query string (pretty much a
necessity if you want plug-and-play black box subsystems coexisting on a
page), you risk of propagating the resetApps parameter and reloading your
app on every page load.

And my point re thread safety still applies - however you do the reload,
threads that were in progress at the time of the reload should continue to
use the old object.

Jaime Metcher

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Larry C.
> Lyons
> Sent: Wednesday, 21 March 2007 6:42 AM
> To: [email protected]
> Subject: Re: [CFCDEV] Newbie - Utility cfc's in application scope
>
>
> A simpler way would be use a url variable to reset the application
> scoped cfc, as in:
>
>
> <cfif NOT structKeyExists(application,"Utilities") or
> structKeyExists(url,"resetApps")>
>    <cflock scope="application" type="exclusive" timeout="10">
>       <cfif NOT structKeyExists(application,"Utilities") or
> structKeyExists(url,"resetApps")>
>          <cfset application.Utilities = createObject("component",
> "Utilities")>
>       </cfif>
>    </cflock>
> </cfif>
>
> that way you don't have to go through all the acrobatics of running a
> separate page etc.
>
> regards,
>
> larry
>
> On 3/19/07, Jaime Metcher <[EMAIL PROTECTED]> wrote:
> >
> >
> > If you want to reinitialize the utilities object, say to
> upgrade it to a new
> > version or to read some new config, you can just do this:
> >
> > <cflock ...>
> > <cfset StructDelete(Application, "Utilities")>
> > </cflock>
> >
> > The next request will then recreate it.  Meantime, any running
> threads will
> > remain unperturbed because they have their own reference to the
> old object
> > in their request scopes.  Once those threads complete, the old
> object will
> > be garbage collected.
> >
> > Jaime Metcher
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of J MacKay
> > Sent: Tuesday, 20 March 2007 6:17 AM
> > To: [email protected]
> > Subject: [CFCDEV] Newbie - Utility cfc's in application scope
> >
> > Hopefully someone can answer two newbie questions ..
> >
> > I've read a few blog entries about storing general utility
> components in the
> > application scope so they can accessed anywhere within the application.
> >
> > <cfif NOT isDefined("application.Utilities")>
> >    <cflock scope="application" type="exclusive" timeout="10">
> >       <cfif NOT isDefined("application.Utilities")>
> >          <cfset application.Utilities = createObject("component",
> > "Utilities")>
> >       </cfif>
> >    </cflock>
> > </cfif>
> >
> > <cflock ...>
> >    <cfset Request.Utilities = application.Utilities>
> > </cflock>
> >
> > It makes sense to instantiate the component once and store it in the
> > application scope, but 1) why copy it back into the Request
> scope ? So it
> > will be available to custom tags?  2) Why is it necessary to
> use a lock when
> > copying the component into the request scope?
> >
> >  ________________________________
> >  No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
> > You are subscribed to cfcdev. To unsubscribe, please follow the
> instructions
> > at http://www.cfczone.org/listserv.cfm
> >
> > CFCDev is supported by:
> > Katapult Media, Inc.
> > We are cool code geeks looking for fun projects to rock!
> > www.katapultmedia.com
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/[email protected]
> >
> >
> > You are subscribed to cfcdev. To unsubscribe, please follow the
> instructions
> > at http://www.cfczone.org/listserv.cfm
> >
> > CFCDev is supported by:
> > Katapult Media, Inc.
> > We are cool code geeks looking for fun projects to rock!
> > www.katapultmedia.com
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/[email protected]
>
>
> --
>
> The real problem is not whether machines think but whether men do. -
> B. F. Skinner -
>
>
> You are subscribed to cfcdev. To unsubscribe, please follow the
> instructions at http://www.cfczone.org/listserv.cfm
>
> CFCDev is supported by:
> Katapult Media, Inc.
> We are cool code geeks looking for fun projects to rock!
> www.katapultmedia.com
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>




You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to