First, if your shared-scope components are carefully designed, chances are good that you won't have any CFLOCKs anywhere outside your CFCs except to protect their initialization. Seriously. The only place you need to lock is where you have race conditions, and those race conditions can only occur with the STATE (instance variables) of your shared instances. Some will argue that the CFC should be environment neutral, and therefore the locking is the responsibility of the environment, but I think that's unnecessary, as it's rare to have CFCs that are both used in isolation as as shared-scope instances. It's far easier to lock inside the CFC, and more performant too.
I usually try to aim for entity components that are NEVER accessed concurrently (so they don't need locking), and for non-entity (service) components that are stateless. The main exception to the latter are caching components, because obviously the cache itself has to be stateful, and therefore needs to have access to it locked. And with entity components, you can certainly share instances across requests, just never at the same time. And finally, keep in mind that session components need locking, unless you can guarentee youself that multiple concurrent requests from a single session will NEVER occur (which is pretty much unguarenteeable). cheers, barneyb On 8/29/05, Burns, John D <[EMAIL PROTECTED]> wrote: > I'm getting ready to start a new app and there are some things I've > learned from other apps that I'm going to implement into this app as far > as CFCs go. I saw the thread concerning the THIS scope which helped to > get some different people's takes on its use. I was wondering if anyone > else would like to post personal or recognized best practices. I am > especially interested in scoping instances of components. I always have > a hard time deciding which scopy to put instances of CFCs into for > different purposes and which kinds of methods I should have in each. > Sometimes, I've overloaded the application scope and end up locking my > application to death for almost everything, but then other times, I > think I put stuff in session that belongs in application. Any advice > would be appreciated, as well as any other best practices that you'd > care to share. I'm always willing to learn. Thanks. > > John Burns > Certified Advanced ColdFusion MX Developer > Wyle Laboratories, Inc. | Web Developer > > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:4:216672 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54