> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 31, 2003 11:38 PM
> To: CF-Talk
> Subject: CFLOCK/application vars
> 
> 
> In our application.cfm file we use a statement like
> 
> <cfif not isdefined("application.exchangerate")>
>       <cflock scope="application" type="exclusive" timeout="60">
>               <cf_exchange>
>       </cflock>
> </cfif>.


A few things:

1) Assuming you're using CF 5 or below then you also need to read-lock
the IsDefined() statement.  IsDefined() is a read of the application
scope.

2) You should EXTREMELY limit the amount of code in a lock, especially
an exclusive lock.  A general rule of thumb is that you shold reduce
code in locks to only CFSETs.

If the operation in this lock takes a long time (and you're locking
properly) then this will create a MARKED impact on performance under
load.

The code you present indicates a little bit of a misunderstanding about
locking.  It's heart is in the right place, so to speak, but it's not
really doing the job.

I invite you to read my in-depth guide to locking in ColdFusion for more
information:
http://www.depressedpress.com/DepressedPress/Content/ColdFusion/Guides/L
ocking/Index.cfm

The guide is most applicable to CF 5 and below, but the concepts are
sound in CFMX.  The main difference is that CFMX doesn't suffer the
stability problems a lack of locking in CF 5- had.  So, for example, in
CFMX you don't have to lock that IsDefined().

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to