Charles Yates wrote:

So, is using 'ThreadSafe' components as singletons that retain state between any given release() and subsequent lookup() a bad idea? I do this a lot. just wondering . . .



Is it a bad idea? Not at all.


Stateless components a good when your dealing with large numbers of clients - they are simple functions that push the obligation for the management of state from the server component to the client. This has a direct impact on the scalability of a particular server architecture. If you have lots of clients - it makes sense to push out the responsibility. Problem is that this question is often considered as a "black or white" concern when in fact this should be considered as "a picture with multiple shades of gray".

Pushing state to the client simply means that your are shifting a part of a system from one place to another. Often it is the case that a client represents the state relative to a particular client. In these cases you can move towards components that are stateless relative to the client - but this does not mean that the server component needs to be completely stateless - if may be dealing with business context that is independent of the client – which cannot be ignored.

Maintaining state between a lookup and a release is perfectly ok - providing that the state is consistent with the existence of the component - e.g. - I create a user object (with state) and I may use lots of stateless objects to support the execution of actions against that user object. But when I say stateless – I’m more than happy to consider an object as stateless relative to another component (but not necessarily stateless relative to all component is associated with).

All of the above should be viewed ion the context of an overall architecture. Often I use singleton components that carry lots of state, and generally speaking the component consumption (dependent client count) is down in the small integers. When I see the potential for pushing state out (without unduly compromising other priorities) - then "relative stateless" components come into the overall equation as means for managing scalability.

Cheers, Steve.

--

Stephen J. McConnell
mailto:[EMAIL PROTECTED]
http://www.osm.net

Sent via James running under Merlin as an NT service.
http://avalon.apache.org/sandbox/merlin




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to