Using the BundleListener interface and the methods BundleContext.addBundleListener(..) and removeBundleListener(..) I wandered whether or not I have to remove a BundleListener before its object is disposed. E.g., if I uninstall a bundle dynamically are BundleListener intances provided by this bundle removed automatically or do I have to unregister them before I uninstall the bundle?

Probably too late to be useful. But when a bundle is uninstalled it first is stopped. This allows the bundles themselves to clean up and remove any listeners they need to. This is important if the bundle has some ordering issue where they need to remove some listeners before disabling some functionality of the bundle on stop().

But the framework is still responsible for removing and remaining listeners which the bundle may have registered with its BundleContext when the bundle is stopped. The end result is that a management agent (doing the uninstall operation) should not have to worry about cleaning up any listeners registered by the bundles it is uninstalling.