Daniel Dekany wrote:
What's the good practice regarding the usage of ServiceManager.release(obj)?
My first guess was that it should be used excessively (lots of
try...finally. PITA), as otherwise the container doesn't know which
components can be freed/reused... but a quick text search in the
tutorial *.java-s showed that it was never used. This may does not mater
to much for singletons (unless I want component expiration), but if the
service happens to be implemented as "transient", it leaks memory with
each lookup() call,
Fear not! Merlin will auto-decommission the object.
as the object will not be released until merlin
shuts down if I don't call release(obj)...
Merlin does not maintain hard references to components which means that objects can be gargage collected but merlin will intercept this process to handle the proper decommissioning of the actual component (i.e. dispose - etc.).
So when should one call release(obj)?
My personal opinion - never - I'm basically of the opinion that a container should not pool components - instead if want pooled components then declare a service specific pool and handle this explicitly. But others may disagree with this conclusion.
Cheers, Steve.
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
