avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Aaron Farr <jaaronf...@yahoo.com>
Subject Re: [Fwd: Re: Lifecycle Help]
Date Sun, 13 Jul 2003 02:15:37 GMT
On Sat, 2003-07-12 at 22:03, Geoff Howard wrote:

> 
> Follow up:
> 
> Is the order of component initialization a reliable contract with the
> Container?  If component A is defined before component B, can it be
> relied on that they are initialize()-ed first A then B?
> 
> Geoff

Are you asking how to know what order components are initialized by the
container?  This depends on the lifestyle of the component and on the
container itself.

However in terms of component assembly (which is what I think you're
asking about), if you access _any_ component via the ServiceManager, it
goes through the proper lifecycle methods before it is returned.  In
other words:

public class ComponentA 
  implements Serviceable, Initializable, MyService {

  ...

  public void initialize(){

    ComponentB b = (ComponentB) 
                     m_serviceManager.lookup(ComponentB.ROLE);

  }
  ...

The 'b' instance of ComponentB will be properly initialized before it is
returned.  In this case you don't need to worry about component
initialization order.  You only need to worry about cyclic dependency
loops.

I'm not sure how well ECM handled all of this, but all the newer
containers should handle this without any trouble.

jaaron


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message