Again I know nothing about Avalon, but there seems to be some conceptual confusion between "Stateless" and "ThreadSafe". Stateless objects are of course thread-safe but stateful objects may be also. A container that automatically turns a "ThreadSafe" component into a singleton seems broken to me. Rather I would have thought that a container would provide synchronization to such components.
My $0.02,
Hmm. The thing is what synchronization would be meaningful? The only real way to ensure a singleton and threadsafety for stateful components is to use a session object for the intermediate state at hand. That session object would have to be ensured is the correct session object for the component at hand. I have put together a system where I could force that to be done behind the scenes, but the synchronization aspects of it make the solution unusable. It was simply too slow and would cause a bottleneck.
Note that in Cocoon 2.2, we will have a new option available to us: Per Thread components. They would be able to keep state within a single thread of execution.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin