RE: thread-saftey of application-instantiated components

2007-02-01 Thread Tero Pikala
Typically you would have something like this in your cfcs: 




[actual implementation]





Using  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


RE: thread-saftey of application-instantiated components

2007-02-01 Thread Richard Kroll
> Yes, the separate calls could get inconsistent data. This is what the
> CFLOCK tag is for.

This is true only if the method is calling / using instance data.

Rich Kroll

~|
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:268314
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: thread-saftey of application-instantiated components

2007-02-01 Thread Richard Kroll
There is the possibility for race conditions, so it depends what your
component is doing.  If your component has the following method:








This method in an application scoped component is thread safe.  There is
no instance data that could change for each request.  

But this method is not thread safe:






Thread safety becomes an issue when you are dealing with instance data
within the component (the variables scope) that could change based on
the actions of a different request.  In cases like this you would need
to lock the transaction just as you would any other shared scope
variable.

HTH,

Rich Kroll


~|
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:268313
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: thread-saftey of application-instantiated components

2007-02-01 Thread James Holmes
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:268310
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4