geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jules Gosnell <ju...@coredevelopers.net>
Subject Re: GeronimoMBeanTarget.doStart() - failure mode ?
Date Fri, 02 Jan 2004 22:13:48 GMT
David Jencks wrote:

> When I asked Dain about this at ApacheCon his explanation was that you 
> should check for all the "able to start" conditions in canStart() so 
> that Start is guaranteed to succeed. 

Aha !

>
>
> When converting AbstractManagedObject thingies to GeronimoMBeans I 
> have generally ignored this advice and simply thrown a RuntimeException. 

i thought of that, but I think you would agree that it is not the best 
solution :-(

>
>
> I think that perhaps it's reasonable to check internal consistency in 
> canStart but not do anything that queries the outside world.  I would 
> prefer an explicit "CantStart" exception in the signature of Start.  
> For instance, if you are opening a server socket, you'd have to open 
> it in canStart and leave it open to guarantee that it will still be  
> available in Start.  AFAIK this won't work if later you decide not to 
> start:-) 

Agreed,

Internal consistency can be checked in canStart(), but anything relying 
on the external world in doStart() cannot be tested, unless you lock the 
whole external world between the canStart() and doStart() methods...

Forunately, the particular case that is troubling me now is one of 
internal consistency...

>
>
> If you agree, want to raise this on the geronimo list? 

I've CC-ed this thread...

Thanks for the helping hand,

Jules

>
>
> thanks
> david
>
> On Friday, January 2, 2004, at 12:09 PM, Jules Gosnell wrote:
>
>>
>> David,
>>
>> What should I do if, in my doStart() method, I decide that my config 
>> is hopelessly screwed and I want to signal to my container that I am 
>> not able to start ?
>>
>> The doStart() signature does not permit any exceptions :-(
>>
>> Oversite or intention ?
>>
>> Cheers,
>>
>>
>> Jules
>>
>> P.S.
>>
>> I could ?maybe? call the GeronimoMBeanContext's fail() method, but 
>> it's not so perspicuous as throwing a well explained exception...
>>
>> -- 
>> /*************************************
>> * Jules Gosnell
>> * Partner
>> * Core Developers Network (Europe)
>> * http://www.coredevelopers.net
>> *************************************/
>>
>>
>


-- 
/*************************************
 * Jules Gosnell
 * Partner
 * Core Developers Network (Europe)
 * http://www.coredevelopers.net
 *************************************/



Mime
View raw message