Hi all,

I'm trying to figure out if the behavior I'm seeing is intentional or a
bug. In my application I have a reference to a DS Component factory. For
example:

@Component(name = "myService", service = "MyService.class", factory =
"myServiceFactory")
public class MyService {
...
}

I'm creating a ComponentInstance via the factory as follows:

@Activator
public MyConsumer(
        @Reference(target = "(component.factory = myServiceFactory)")
                ComponentFactory<MyService> factory) {
    factories.put("someId", factory.newInstance(new Hashtable<>()));
}

and I have a ServiceTracker in another Component which is tracking
instances of MyService. The problem I am seeing is that upon calling
ServiceTracker.close() the Felix framework is deactivating the MyService
instance I created via the ComponentFactory.  It seems this happens because
the useCount drops to zero and therefore the instance is disposed.

Is the above behavior to be expected within the context of a
ComponentFactory?  I assumed that disposal would only occur if the
Component became unsatisfied or if I explicitly called
ComponentInstance.dispose() myself?

Thanks,
Chris

Reply via email to