commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Essl <christiane...@yahoo.de>
Subject Re: [Hivemind] ServiceImplementationFactory - no Exception (?)
Date Thu, 18 Mar 2004 21:39:27 GMT
Yes as said I share your concerns but let me explain why they are not so 
easy to adress.

First - wheter it's good or bad - Hivemind does not construct or 
initialize service-implementations when the Registry/modules/services are 
loaded/build. Services are lazy-loaded.

Second you get an exception with registry.getService() if you use the 
primitive model. This also enforces non-circularity, which is IMO anyway 
the better design.

Third if you are fine with an NPE, why are you not fine with an 
ApplicationRuntimeException, which will be thrown in exactly the same 
cases an NPE would be thrown?

Apart of this you get half-initilized service-proxies because of circular 
references - service CHICKEN wants service EGG set and vice versa. It's 
just so that you can't give B for full initilization a full-initialized A 
if A needs a full-initilized B.

Proxies have the advantages that in a multi-threaded enviroment 
lazy-loading is possible without a lot of locking and that trying to call 
a non fully setup service always leads to an exception (maybe later but 
sure).


On Thu, 18 Mar 2004 12:15:06 -0800, <btomasini@neteverything.com> wrote:

> Please remember that I have only used HiveMind here for a few days, so 
> feel free to add large grains of salt to these thoughts.
>
> I think I see what you mean.  Two me, there are two sides of this.
>
> 1. On the intial load of modules / services, I would like to see the 
> application have a complete excepion chain to whatever is loading the 
> registry.  In specific, Intializable.initializeService does not throw an 
> exception.  If there is an error in here, it would be nice for the 
> registry to know about it, log it, and invalidate the service.
>
> 2. On the getService side, here are my thoughs.
>
>   (A) If a service fails to initialze in step 1, have getService throw 
> and exception, too.  That is fine with me.
>
>   (B) If a service fails to initialize in setp 1, return null.  This is 
> also fine with me.
>
>   (C) If a service has an error initializing, say in 
> Initializable.initializeServce, why would I want an instance of 
> anything?  To me, a half-initialized service is worse.
>
> I want my service to run 100% out of the box, or have a good strong 
> error, even an NPE from the calling application (B above).  I see no 
> value in pretending everything was ok.
>
>
> On Thu, 18 Mar 2004 12:08:48 -0500
>   Harish Krishnaswamy <hkrishnaswamy@comcast.net> wrote:
>> Let me ask you this, how are contemplating handling these exceptions? 
>> Are you going to be catching exceptions when ever you do a lookup or 
>> are you planning on letting these exceptions cascade up to the top and 
>> throw a message to the client. 'Cause either way would be no different 
>> than what it is now, wouldn't you say?
>>
>> -Harish
>>
>> btomasini@neteverything.com wrote:
>>
>>> Great!  I may take my hand at a patch, but I fear am too new to this 
>>> project to get my head around it.  Maybe I will Bugzilla this one if I 
>>> have some time.
>>>
>>> Great product all in all.  BTW, any thoughts for 
>>> Intializable.initializeService() throwing an exception, too?
>>>
>>> I don't want to open pandora's box here, but I hit a similar issue 
>>> with that as well.
>>>
>>> Ben
>>>
>>> On Wed, 17 Mar 2004 23:32:04 -0500
>>> Harish Krishnaswamy <hkrishnaswamy@comcast.net> wrote:
>>>



-- 
Christian Essl 

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


Mime
View raw message