On Apr 7, 2005 1:28 PM, Ali Awan <[EMAIL PROTECTED]> wrote:
> Let me know if I used it correctly.

For performance reasons you should not lock on every request (and,
since you're using a prefuseaction you are potentially locking several
times per request).

That's why I suggested the if-lock-if strategy.

So if the following is allowed by Fusebox - it will definitely give
you better performance:

> <prefuseaction>
     <if condition="NOT StructKeyExists(application,'appInitialized')">
     <true>
>    <aa.lock mode="start" type="exclusive" scope="application" />
>       <if condition="NOT StructKeyExists(application,'appInitialized')">
>          <true>
>             <instantiate object="application.statesManager" class="States" 
> arguments="request.DSN1"/>
....
>             <set name="application.appInitialized" value="1"/>
>          </true>
>       </if>
>    <aa.lock mode="end" />
     </true>
     </if>
> </prefuseaction>

The vast majority of requests will just execute the outer if (safely)
and not need to lock. However, if the outer if is true (the app is not
initialized), then you still need the lock and the inner if to ensure
the app is only initialized once.
-- 
Sean A Corfield -- http://corfield.org/
Team Fusebox -- http://fusebox.org/
Got Gmail? -- I have 50, yes 50, invites to give away!

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:12:6706
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/12
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:12
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.12
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to