What Sean is suggesting as a 'UserService' can be thought of a a SessionFacade. This is an object that you use to encapsulate all access to the Session, and can provide methods like 'getCurrentUser()' or 'getValue(key)' (along with accompanying setters. Inside these methods you would directly access session and provide proper locking. This SessionFacade can be a singleton defined in ColdSpring, and provided to all your other beans that require some bit of data from Session.

You also asked a question about why instantiate all your DAOs (and other singletons) on application startup instead of on request. Object creation is overhead that you have no reason to incur on user requests, when you have a load cycle that is a perfect place to preform your initialization. If you leave this to 'on demand' you also need to figure out if the object exists, before creation, and that whole process needs to be single threaded with proper cflocking. This will add even more overhead, and negate some of the benefits of using a framework like ColdSpring to manage your application components.


Chris Scott
[EMAIL PROTECTED]
http://cdscott.blogspot.com/
http://www.coldspringframework.org/


<<inline: TeamFusionD.gif>>







On Nov 4, 2007, at 1:40 AM, Sean Corfield wrote:

On 11/3/07, Mike Kear <[EMAIL PROTECTED]> wrote:
Yes it does help indeed! Thanks Sean. And it answers some questions that were niggling away in the back of my brain but hadn't come to the front yet. (in other words you answered some questions I hadn't even asked myself yet)

Sweet. Let me know if you have other questions (and feel free to
contact me via IM with questions any time you need).
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

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


Reply via email to