axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <>
Subject Re: [axis2] AxisConfiguration.getService() and inactive services
Date Thu, 21 May 2009 01:01:06 GMT
Hi Deepal:

Deepal jayasinghe wrote:
> Yes, there is a difference. One method is for management other method is
> for dispatching.
> So at the runtime when a message receive we call getService, and if we
> want to activate, inactivate we call other method.

Throwing an exception to do this is (IMHO) bad code.  It's expensive, slower,
non-intuitive (what would you expect "getService()" to do?) and just plain
annoying for people calling this method.

getService(name) should return the AxisService matching the name if there is
one, period, end of story, just like all the other accessors like it do.

If you don't want the dispatch code to call "isActive()" on the resulting
service (which IMHO isn't that egregious), a getActiveService(name) utility
method would be fine, which would simply return null if there was a service
by the specified name that was inactive.  No exceptions necessary.



P.S.  This is all not to mention that "getServiceForActivation()" is a
terrible name for a method that simply returns you a service.

> Deepal
>> Hi y'all:
>> So I'm cleaning up a little code and javadoc, and happened to come across
>> AxisConfiguration.getService()... which *throws an Exception* if you ask for
>> an inactive service.
>> ...which is why we have a second method called "getServiceForActivation()"
>> that simply avoids the check and the exception.
>> Does this make sense?  Why?
>> --Glen

View raw message