geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Bartel <j...@mortbay.com>
Subject Re: [jsr77][core] AbstractContainer start dependancies
Date Mon, 15 Sep 2003 22:17:49 GMT
Dain,

> On Sunday, September 14, 2003, at 07:54 PM, Greg Wilkins wrote:
> 
>> Jan has noticed that the current implementation of 
>> AbstractContainer.addComponent
>> creates a start dependancy so that the component must be started 
>> before the
>> container is started.
> 
> 
> Really.  That is backwards.  A child can't move to the running state 
> until the parent is in the running state.
Yes, I think the addStartDependency args were typed in in the wrong 
order. I haven't committed the switch around yet.
> 
>> I think this is the wrong way around, as it is legal in jsr77 for a 
>> container to
>> contain stopped components - else startRecursive would not be needed.
>>
>> This is causing Jan grief with the webcontainer, as it is insisting that
>> the webconnectors and webapplications are started before they are
>> added to the webcontainer - which is not possible.
> 
> 
> I'm not sure what you are saying here.  Declaration of a dependency is 
> completely disconnected from the state of either object.
On AbstractContainer, a call to addComponent () results in the addition 
of a start dependency on child to parent (well, it will be when we 
switch the args around). Whenever the Container (courtesy of inheriting 
the handleNotification() method from AbstractStateManageable) receives a 
jmx notification, it re-checks its dependencies to see if it should make 
a lifecycle change (eg start or stop because of it's dependencies).

Because the start dependecy was set up incorrectly, with the parent 
depending on the start state of it's child, when the already started 
parent received jmx notification of the registration of the 
not-yet-started child, the state dependency checking in checkState() 
decided that the parent must stop running because the child wasn't yet 
running.

>> I have changed this so that the dependancy says that the container must
>> be started before the component is. It does not appear to break 
>> anything else
>> and it makes Jan's webcontainer start.   So I'll go for a lazy 
>> consensus on
>> this and commit this change tuesday unless anybody objects.
> 
> 
> What did you change?  I can't seem to find it.  
I don't think the change has been committed yet.

> Anyway, I think we 
> should change the signature of DependencyService from
> 
> addStartDependency(ObjectName startChild, ObjectName startParent)
> 
> to
> 
> addStartDependency(ObjectName startParent, ObjectName startChild)
> 
> It is just more natural to think parent then child.

That'll really confuse things :-)  I actually think it is better the way 
it is,  so you are stating the thing that is dependent before the thing 
on which it is dependent (in English: THIS depends on THAT).

Jan



Mime
View raw message