Hello Jürgen, Just to make sure: a service is unregistered when the bundle that registered it is *stopped*, so not on shutdown (of the framework).
Other than that, performing explicit cleanup in your code makes perfect sense, and OSGi defines an explicit life cycle for those cases. Greetings, Marcel On 14 Apr 2014, at 8:06 , Jürgen Rose <[email protected]> wrote: > I'm just a bit paranoid about disposing services correctly. Of course you are > right about the automatic deregistration on shutdown. Its just out of habit > that I deregister every service manually, but then in most of our code there > is actually some dispose method which has to be called, so it is a necessity > (mostly executors which have to be shut down). > > Jürgen > > Am 13.04.2014 11:50, schrieb Marcel Offermans: >> On 13 Apr 2014, at 10:02 , Neil Bartlett <[email protected]> wrote: >> >>> On Sat, Apr 12, 2014 at 11:05 PM, Jürgen Rose <[email protected]> >>> wrote: >>> True, but a lot of projects (Eclipse since the move to OSGi, Apache since >>> Felix/Karaf etc became more prominent, Spring, ...) have now jars which >>> have correct OSGi meta infos already. >>> >>> Dave Cramer from the postgres JDBC driver encouraged me to send a pull >>> request and he will merge it onto the current branch. So we can use the >>> JDBC driver directly in the future. I'm just waiting for a answer here on >>> this list how to handle the properties correctly. >>> >>> I didn't talk about the DataSource, the OSGi service doesn't get >>> unregistered, which is at least bad style. >>> >>> Can you clarify what you mean by this? The DataSourceFactory service >>> doesn't get unregistered when the bundle stops? That's actually >>> impossible... OSGi services are automatically unregistered when the >>> publishing bundle stops. >> >> Unless, by accident or design, a bundle registers a service with the >> BundleContext of a *different* bundle. So far that sounds unlikely though. >> >> Greetings, Marcel >> >> >> >> _______________________________________________ >> OSGi Developer Mail List >> [email protected] >> https://mail.osgi.org/mailman/listinfo/osgi-dev > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
