> >   2 - 1000 users are clicking at 00:00 AM to delete their emails
> >(Application.MailService.DeleteMail)... at exactly the same time that
> >the
> >creation of the Application.MailService variable is being created.

> All those requests will go through Application.cfm so they'll actually
> be waiting for step 1 to complete.

Thanks Sean, I was missing this part. Your are right the 999 other users
will wait the cflock in the application.cfm. I feel more secure now.


----- Original Message ----- 
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 1:35 AM
Subject: Re: [CFCDev] CFCs in memory


On Monday, Jul 28, 2003, at 20:19 US/Pacific, Stéphane Bisson wrote:
> Thanks to make me understand... but I'm just questionning on one
> thing...
> Let's take this example...
>
> I have this in my Application.cfm
>
> <cfif NOT IsDefined("Application.MailService")>
>    <cflock scope="Application" Timeout="10" THROWONTIMEOUT="No"
> Type="Exclusive">
>      <cfif NOT IsDefined("Application.MailService")>
>       <cfobject component="#request.componentpath#MailService"
>  name="Application.MailService">
>      </cfif>
>    </cflock>
>  </cfif>

Looks good.

>    1 - The application.cfm is instantiating the MailService CFC into
> the
> Application.MailService

Which means one thread is busy instantiating it and the other 999
threads are locked waiting.

>    2 - 1000 users are clicking at 00:00 AM to delete their emails
> (Application.MailService.DeleteMail)... at exactly the same time that
> the
> creation of the Application.MailService variable is being created.

All those requests will go through Application.cfm so they'll actually
be waiting for step 1 to complete.

>    3 - Is the java runtime will take care to say to these 1000 users...
> WAIT.... until the Application.MailService is created! or it will
> failed!...
> or it will do both!

It will queue them all up waiting for the lock to be released
(hopefully taking less than 10 seconds) and then those requests will be
processed in turn, each getting the lock and testing cfif and finding
someone else has already created the mail service object.

> As you can see I'm thinking big for my site, if I have 100 000 users’
> on
> lines... there's a chance that it could appended... and I don't want to
> received 1000 emails because I created an Error Service component...

Hopefully you'll agree that the logic above makes it work the way you
need?

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