Ulrich Mayring wrote:
Robert McIntosh wrote:

One that maintains no client/caller state between method invocations,
just like EJB Session beans (stateless ones obviously), and they
certainly have a lifecycle to them. In avalon a component could be
Configurable, Initializable, etc., all of which are lifecycles.

Basically you're saying that components following the IoC pattern are
stateless by definition. The caller maintains state, not the callee.

In web applications, however, stateless means also thread-safe (many
clients on one URL simultaneously). And lifecycles tend to kill
thread-safety, so you need to pool. But the original poster wanted singletons.
A component cannot be accessed until it is completely instantiated.
As soon as you have the component in your hot little hands, it has
already been initialized and put through the lifecycle.

No need to pool, no need to restrict from singletons, and no need to
force them either.  What kills thread-safety in a component interface
is when they have to be stateful such as with a component that
implements the SAX ContentHandler interface.  The interface forwards
events to another content handler which is set before any methods
are called.  Also the methods have to be called in a specific order.
In a multithreaded environment you cannot use a singleton for that
purpose.

However, if the component does not need to store information, and
does not force the client to call methods in a specific order, then
all is well.


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

Reply via email to