avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: When use ServiceManager.release(obj)?
Date Mon, 15 Dec 2003 10:38:42 GMT


> From: Niclas Hedhman [mailto:niclas@hedhman.org] 
>
> Back to the bottom-line; What about 
> ServiceManager.release()?? Should it be 
> deprecated? 
> IMHO, 
> 1. Deprecated, or
> 2. Enforced, or "soft enforced" (i.e. reported as a problem).
> 
> I don't really care which one, but having a weak contract is not good.

(I have seen this bottom line before.)

Niclas,

basically, we've been here before. The sequence is usually that someone
introduces the concept of no release. Then someone else pops up with
a use case that *requires* a release. Then we get a marker interface
or extension like ReleaseRequirement. Then someone remarks that you
have to test for this *all the time*. Then someone comes up with
something
like ReleaseUtils.maybeRelease (Object component), that will do the test
for you and release if needed. Then someone adds 1 and 1 and figures
that
since ReleaseUtils.maybeRelease must be called *all the time*, we might
as well use release() as we did in step 1.

The only way out is to do a huge backwards-incompatible change: No
relase() 
at all. All components are singletons. If you want something else, you
have 
to code it yourself. For example, instead of looking up SAXTransformers,
you do one lookup for a SAXTransformerFactory in the service() method,
and
then you use that factory.

/LS


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


Mime
View raw message