You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Michael McKibben <mi...@hihat.net> on 2002/06/12 22:00:51 UTC

Confusion on ThreadSafe meaning

Hello, I have been silently following the recent discussion on the new CM
and have a question about what it means for a component to be
thread safe. 

In my mind I feel that thread safe is being mixed up with "stateless". In
other words, a "stateless" component implies that it is thread safe, but the
relation is not if and only if! I can imagine a component that is
perfectly thread safe but not stateless. With a stateless component, it
make sense that cm.lookup() will always return the same component, but if
the component is statefull, then it should always return a new component
(or pooled.)

So with the new CM, do we have to assume that everything returned from
lookup() is stateless and use a factory interface for stateful components?
If we make the statefullness of a component a property of the metadata,
then the CM can at least be smart enough to return a shared or new
instance of the component. I am thinking along the lines of a Session EJB.
One thing I like about the EJB design is that an EJBObject has a remove()
method and the stateful vs stateless behavior is a property of the
metadata. This design makes it easy to develop a generic container/factory
for Session beans. Now, in the Avalon world, what if remove() was added to
the Component interface and the CM looked for some attribute in the
component's config to determine its statefulness? 

Regards, 

--mike


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>