Leo Sutic wrote: > > From: Robert Mouat [mailto:[EMAIL PROTECTED]] > > > > Leo Sutic wrote: > > > > > this is my understanding of the sort-of concensus we have arrived at. > > > Some issues are still being debated, and I believe I have marked those > > > as such. > > <snip/> > > > We've agreed on removing release() from the CM interface, and the rest > > > of this sumary details how we get the same functionality without that > > > method. > > > > > > We've agreed that all components returned from a CM are thread safe. > > > > I must have missed this (in my desire not to read any emails > > containing "ROLE",hint vs. "ROLE/hint" :)... so I'm going to > > ask: why must they be thread safe? > > Because they are looked up in compose() and then stays with the > composer for the composer's lifetime. As there may be several threads > in the composer accessing that component, it must be thread safe.
oops, looks like I confused threadsafe with singleton. I think I understand this a little better now: interfaces that imply a transaction also hint at non-threadsafety (i.e. prevent the assumption of threadsafety)... but, understanding that, is it a policy to discourage the use of the ComponentManager outside of compose(), i.e. are the following bad: private ComponentManager M_cm; private TypeOneInterface m_type1; public void compose( Component Manager cm ) { m_cm = cm; } public void initialize() { m_type1 = (TypeOneInterface) m_cm.lookup( "TypeOneInterface" ); } public void doStuff() { type2 = (TypeTwoInterface) m_cm.lookup( "TypeTwoInterface" ); type2.begin(); //... type2.end(); } or private TypeTwoInterface m_type2; public void begin() { m_type2 = (TypeTwoInterface) m_cm.lookup( "TypeTwoInterface" ); m_type2.begin(); } public void foo() { m_type2.bar() } public void end() { m_type2.end(); m_type2 = null; // let the GC clean it up :) } why is it wrong for the composer you mention to not be threadsafe? and if it declares itself non-threadsafe (or fails to decleare itself threadsafe), how is it bad to use a non-threadsafe component over several methods (as in the second example above)? Robert. P.S. apologies if this has been covered in a previous thread. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>