Hi Luca, Luca Ferrari schrieb: > On Friday 12 December 2008 09:40:11 Felix Meschberger wrote: > >> At the end of the day, it all amounts to the service consumer >> responsibility to let go of a service and its reference when the service >> is unregistered, which is also the case when the containing bundle is >> stopped. >> > > Thanks, but the question that arises now is: how does a container that a > service consumer will not "crash" the osgi mechanism holding a reference to > an > uninstalled service? Should the container trust the service consumer or does > it not make sense worrying about the service consumer?
The container cannot do anything about a service consumer not releasing a reference. It is the consumer itself holding the reference, and what may happen, when the service is used depends on the service, it may throw exceptions etc. etc. One thing is sure: as long as the service consumer holds on to a stale (removed) service, the service object cannot be garbage collected. As a consequence the bundle cannot be garbage collected etc. etc. There is one catch though, but you should (or rather must ?) not depend on this: If the service interface provided by the service has been provided by the same bundle as the service implementation itself, the bundle of the service consumer will be refreshed (hence at least stopped) if the providing bundle is uninstalled and the packages are refreshed through the PackageAdmin service. It really, really _is_ important that service consumers let go off services, which are unregistered. Regards Felix _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
