Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Do I have to remove BundleListeners when Bundles are uninstalled?(Does Eclipse manages the listeners in a weak datastructure or removes them automatically?)
icon5.gif  Do I have to remove BundleListeners when Bundles are uninstalled? [message #502821] Wed, 09 December 2009 19:52 Go to next message
Claas Wilke is currently offline Claas WilkeFriend
Messages: 5
Registered: November 2009
Junior Member
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?
Re: Do I have to remove BundleListeners when Bundles are uninstalled? [message #508650 is a reply to message #502821] Tue, 19 January 2010 17:40 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 479
Registered: July 2009
Senior Member
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.


Previous Topic:question about the OSGi, equinox, eclipse
Next Topic:OSGi - NullPointerException in ContextFinder
Goto Forum:

Current Time: Sun Apr 22 10:44:15 GMT 2018

Powered by FUDForum. Page generated in 0.02001 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software