Thanks! Maybe good to mention that I have a workaround for the issue, by adding a bundle dependency [1] to the component that creates and removes these services everything works ok.
Regards, Bram 1: createBundleDependency().setBundle(context .getBundle()).setStateMask(Bundle.ACTIVE).setRequired(true) On Thu, May 26, 2016 at 9:05 AM Pierre De Rop <[email protected]> wrote: > ok Bram; I will try to reproduce this issue with a test case. (I'm off this > morning, will do it this afternoon). > > cheers; > /Pierre > > On Thu, May 26, 2016 at 8:58 AM, Bram Pouwelse <[email protected]> wrote: > > > I use an Activator and create a component with service dependencies, when > > services are added / removed the component will add / remove additional > > components. This all works but if a component is removed before the > > BundleActivator#start method has completed the service will stick around > in > > the service registry. > > > > Regards, > > Bram > > > > On Thu, May 26, 2016 at 8:51 AM Pierre De Rop <[email protected]> > > wrote: > > > > > but the Activator is invoked only when the bundle is started. I'm not > > sure > > > I understand ? > > > Are you invoking the Activator.init method from another bundle, like an > > > extender bundle which would track all install/resolve bundles and would > > > instantiate an Activator from a not started bundle and invoke it ? > > > > > > thanks; > > > /Pierre > > > > > > On Thu, May 26, 2016 at 8:46 AM, Bram Pouwelse <[email protected]> > > wrote: > > > > > > > Hi Pierre, > > > > > > > > Thanks for the quick reply. I should've been a bit more clear in my > > > > message, the problem is when you remove a component before the bundle > > is > > > > started (that's why I used the Activator to demonstrate the issue). > > Once > > > > the test you've created runs the bundle is already started and all > > works > > > as > > > > expected. > > > > > > > > Regards, > > > > Bram > > > > > > > > On Thu, May 26, 2016 at 8:15 AM Pierre De Rop < > [email protected]> > > > > wrote: > > > > > > > > > Hi Bram, > > > > > > > > > > The service should be removed from the service registry when you > > remove > > > > the > > > > > Component from DependencyManager. > > > > > > > > > > Now, I tried to reproduce the issue you are describing in [1], but > I > > > > could > > > > > not (the test is OK). > > > > > Can you please take a look at it in order to see if it the same > kind > > of > > > > > scenario you have ? Am i missing something ? > > > > > > > > > > thank you; > > > > > > > > > > cheers; > > > > > /Pierre > > > > > > > > > > [1] > > > > > > > > > > > > > > > > > > > > http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/AddRemoteTest.java > > > > > > > > > > On Wed, May 25, 2016 at 8:38 PM, Bram Pouwelse <[email protected]> > > > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I have an issue with a bundle that removes a DM component before > > the > > > > > bundle > > > > > > is started. If that happens the service remains available in the > > > > service > > > > > > registry. > > > > > > > > > > > > I could reproduce this using a simple activator (which doesn't > make > > > any > > > > > > sense but works to demonstrate the issue). > > > > > > > > > > > > public class Activator extends DependencyActivatorBase { > > > > > > > > > > > > @Override > > > > > > public void init(BundleContext arg0, DependencyManager dm) > throws > > > > > > Exception { > > > > > > Component addRemove = > > > > > > createComponent().setInterface(Object.class.getName(), > > > > > > null).setImplementation(Object.class); > > > > > > dm.add(addRemove); > > > > > > dm.remove(addRemove); > > > > > > } > > > > > > } > > > > > > > > > > > > After starting this bundle the dm gogo command doesn't list any > > > > > components > > > > > > but the service is available in the service registry. > > > > > > > > > > > > g! dm > > > > > > > > > > > > g! inspect cap service 1 > > > > > > dm.test [1] provides: > > > > > > --------------------- > > > > > > service; java.lang.Object with properties: > > > > > > service.bundleid = 1 > > > > > > service.id = 4 > > > > > > service.scope = singleton > > > > > > > > > > > > g! > > > > > > > > > > > > > > > > > > Is this expected behavior or a bug? > > > > > > > > > > > > Regards, > > > > > > > > > > > > Bram > > > > > > > > > > > > > > > > > > > > >

