On Thu, 14 Feb 2002 17:34, Ryan Shaw wrote: > Peter wrote: > ||| > As long as components are looked up and released in the initialize > ||| > and dispose methods you shouldn't be able to get into any circular > ||| > dependency problems. > ||| > ||| Theres no need to ever release the components if you are using it in > ||| this fashion. The container can record which components are requested > ||| and automatically release them when destroying the component (this is > ||| what phoenix does because it makes it easier for block writer). > > how would the container know which components had looked up which > other components? > > suppose component X looks up component Y but never releases it. > > when disposing of X, the container knows that Y is "checked out" > but it doesn't necessarily know that X is the component that has > it checked out.
Well some implementations do track it - I think I made the phoenix one do it - or at least I was planning to make it do it ;) Everytime there is a call to lookup() your ComponentManager marks which component was requested. You make sure that you have a separate ComponentManager instance for each component (probably all inheriting from a central ComponentManager). When that component gets shutdown you end up with a list of components that it requested. Thus you know that which ones are still checked out by the dead component :) That make sense ? -- Cheers, Pete ------------------------------------------------------------- | Egoism is the drug that soothes the pain of stupidity. | ------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
