I'm reading back my emails to figure out if I'm doing it ok!. I'm trying to
know if I should always use cflock when I'm using a CFC instance store in
the Application scope! I think I understood that I should use cflock
exclusive when it's created like this...

Application.cfm

<cfif NOT IsDefined("Application.ValidateService")>
 <cflock scope="Application" Timeout="10" THROWONTIMEOUT="No"
Type="Exclusive">
    <cfobject component="#request.componentpath#ValidateService"
name="Application.ValidateService">
 </cflock>
</cfif>

MyCFC.cfc
...
 <cflock scope="Application" Timeout="10" THROWONTIMEOUT="No"
Type="ReadOnly">
      <cfset in_message = Application.ValidateService.Filter(in_message)>
 </cflock>
...

Is it the good way to prevent race condition! I think I heared once that I
don't need to put cflock readonly! but I don't remember why!

Thanks

Stef




----- Original Message ----- 
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 11:42 PM
Subject: Re: [CFCDev] CFCs in memory


> On Thursday, May 29, 2003, at 15:19 US/Pacific, Raymond Camden wrote:
> > Good point. What about the CFC itself handling any locking? Would it
> > make more sense in there then 'on the outside'? My gut feelings say the
> > CFC should do all the work for me.
>
> Well, yes, it would be nice to know that the CFC is multi-thread safe
> but that doesn't actually solve the "initialize only once" problem,
> which is what the if/lock/if does... If your locking is inside the CFC,
> you've already had to initialize it before the code inside can deal
> with locking... so it would only trigger if you actually initialized it
> more than once at the same time... which is what we're trying to avoid!
>
> Sean A Corfield -- http://www.corfield.org/blog/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to