Berin Loritsch wrote:

> > From: Robert Mouat [mailto:[EMAIL PROTECTED]] 
> > 
> > Michael McKibben wrote:
> > 
> > > Isn't this a chicken-and-the-egg problem? The CM must know which 
> > > component instance to call lookup() on! Perhaps if it was a static 
> > > method that was introspected, but I'm not sure that is a viable 
> > > solution. JNDI has some nifty solutions that might be possible to 
> > > borrow from, e.g. the Referenceable interface and the 
> > > ObjectFactory/ObjectFactoryBuilder.
> > 
> > that's why I suggested that they be singletons (i.e. only one 
> > instance of the component).
> > 
> > however - even if they were given some other lifestyle it 
> > would still work, there would just be redundant instances.
> 
> Keep in mind that there are ways of creating singletons without static
> accessors.  However that gets back to the ThreadSafe argument, which
> is what we are wanting to solve.  Meta Data is the best way of doing
> this.

I did mean 'singletons' in a threadsafe/non-static way.  In fact I was
thinking that you'd want to be able to create several singleton components
from the same class...

e.g. if there are 2 components A and B - and I want to trace method calls
on both of them.  I could create 2 proxy components A-trace and B-trace to
trace the method calls (as per previous email).  A-trace and B-trace would
both be singleton components (there is no need to create more than one
instance) - however they would both be of the class TracingProxy but
configured differently.  Hence static methods wouldn't work very well.

Having said that I would make them singletons - they don't *need* to be
used that way - there is no reason why a new instance of A-trace couldn't
be created every time someone wanted the component A (though this is
probably not going to be the most efficient way of doing things).

Robert.


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

Reply via email to