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 > > > > > >

