Typically you would have something like this in your cfcs: 

<cffunction name="action" returntype="Any">
        <cfset var local = StructNew()>
                
        [actual implementation]
                
        <cfreturn local.retval>
</cffunction>


Using <cfset var creates separate scope for each time you invoke your
method. 

If you really need to single thread your calls <cflock> is good way to do
it, but that will limit application scalability. 


Tero Pikala


-----Original Message-----
From: James Holmes [mailto:[EMAIL PROTECTED] 
Sent: 01 February 2007 13:22
To: CF-Talk
Subject: Re: thread-saftey of application-instantiated components

Yes, the separate calls could get inconsistent data. This is what the
CFLOCK tag is for.

On 2/1/07, Leitch, Oblio <[EMAIL PROTECTED]> wrote:
> If I create a component (potentially long-running) and instantiate it
> into the application scope (so all pages can access it), how thread-safe
> will it be?  That is, if two pages call it simultaneously is there any
> chance one will get the results of the other?  Or maybe I'm being
> paranoid and don't understand what "thread-safe" really means or where
> it's a concern?

-- 
CFAJAX docs and other useful articles:
http://www.bifrost.com.au/blog/



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268322
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to