On Aug 1, 2006, at 5:29 PM, Ken Tam wrote:
I was seeing a ScopeNotFoundException rather than an NPE I think, but yeah, it happened when a component defaulted to STATELESS scope (in the absence of an @Scope("MODULE")). I talked with Jim and we came to this fix together.
OK - thanks for fixing this.
Just so's I understand what you're saying -- the problems you're describing are theoretical at this point, right? Because the current scope factories are trivial in their "construction" (ie, the ctors don't do anything, nor do the init methods), any races between ctor/init completion & other code calling into the factory aren't actually a problem (given the super class's ctor will always be completed).
I don't think so - once you call register, another thread could call the registry which may invoke you before the constructor had completed. There were some changes to how object construction worked in the 1.5 memory model so this may not be an issue any more.
That said, agree the code should always do the right thing :) My understanding of component instantiation is ctor followed by init method -- so we could store the injected ScopeFactory in the ctor and do the register call in the init, and then clear the injected ScopeFactory reference (avoiding circular references). Is that what you're suggesting by "waiting until their init method is called" ?
Yes.
Jim & I also discussed a more complex solution involving making the scope registry "watch" for newly created scope factories and register them, but given the seriousness of the problem, having some solution checked in seemed expedient.
Agreed. Jim, Sebastien and I had discussed mapped multiplicity references before as well. The application here would be the registry having a multiplicity reference of type Map whose members would be automatically managed by the fabric. As eligible services came online (based on rules associated with the reference) their key would be extracted and they would be inserted in the Map.
BTW, does @Init work with inheritance? Ie, if my super-class has a method marked @Init, will that method get called before my @Init method?
I believe there can only be one method marked @Init across the implementation and its superclasses. Normal Java method overriding is followed (so if you override it your declared method will be called and it is your responsibility to call the superclass method that you override).
-- Jeremy --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]