>>However, the implementation of equinox's ds indeed
do the enabling operation in a work thread.
This is how the OSGi spec requires the
enableComponent method to behave:
methods must return after changing
the enabled state of the named component. Any actions that result from
this, such as activating or deactivating a component configuration, must
occur asynchronously to the method call. Therefore a component can disable
>>My app intermittently suffer the NPE when using
the service due to the enabling operation is not completed yet in other
I would suggest not attempting to acquire a service registered
by the recently enabled DS component, but rather create an entirely separate
DS component that has a <reference> on the service you wish to acquire.
In this way you'll be certain to never get an NPE by having a DS
component that will only have its configuration satisfied, and therefore
activated, once you have enabled the DS component that provides the service.
I have a DS component that is not enabled when started.
It won't be enabled until some conditions are satisfied. So I manually
call ComponentContext.enableComponent to enable the specified component.
However, the implementation of equinox's ds indeed do the enabling operation
in a work thread. My app intermittently suffer the NPE when using the service
due to the enabling operation is not completed yet in other thread.
I read the source code of equinox's ds, but I don't see any event is broadcasted
after enabling a component.
Is there a way to be notified after the component is changed? Or enable
the component via a synchronized calling.