I've got the following setup:
Bundle 1: Implements a pattern similar to the extender pattern. A bundle tracker monitors bundles containing a certain configuration entry. Each time a bundle with the coniguration entry enters or leaves the ACTIVE state, a service of the interface "com.example.bundle1.Bundle1Service" is unregistered and a new service with the same interface is re-registered.
Bundle 2: Has an immediate service component with the following configuration:
<component name="Bundle2Component" immediate="true" xmlns="http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="com.example.bundle2.TestComponent" />
<provide interface="java.lang.Object" />
Situation: Both bundles have been started. The service component from bundle 2 is active and the reference is bound to the current Bundle1Service exported from bundle 1.
Now, when i stop bundle 2 the following occur:
1. The state of bundle 2 is changed to STOPPING
2. The state change is discovered by the service tracker in bundle 1 which causes it to unregister the Bundle1Service and then register a a new Bundle1Service.
3. The SCR discovers that the bundle1service reference of the component has become unsatisfied and deactivates the component.
4. The SCR discovers that the bundle1service reference of the component has become satisfied (with a new service) and activates the component.
5. The SCR tries to export the newly activated component as a service, but fails since the bundle is stopping.
The problem seems to be that SCR has not discovered that the bundle is STOPPING and disabled the component. A simple fix might be to check whether to disable the component based on bundle status before activating a new instance of the component.
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|19d 9h 53m||1||Felix Meschberger||11/Oct/11 18:23|
|405d 16h 34m||1||Felix Meschberger||20/Nov/12 10:58|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Fix Version/s||scr-1.6.2 [ 12315248 ]|
|Resolution||Fixed [ 1 ]|
|Field||Original Value||New Value|
|Assignee||Felix Meschberger [ fmeschbe ]|