You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (Resolved) (JIRA)" <ji...@apache.org> on 2011/10/11 20:25:12 UTC

[jira] [Resolved] (FELIX-3126) SCR activates a service component while the containing bundle is stopping.

     [ https://issues.apache.org/jira/browse/FELIX-3126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-3126.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: scr-1.6.2

Considering this issue fixed. If it ain't so, we can still reopen.
                
> SCR activates a service component while the containing bundle is stopping.
> --------------------------------------------------------------------------
>
>                 Key: FELIX-3126
>                 URL: https://issues.apache.org/jira/browse/FELIX-3126
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>         Environment: FELIX-3.2.2, SCR-1.6.0
>            Reporter: Soren Petersen
>            Assignee: Felix Meschberger
>             Fix For: scr-1.6.2
>
>
> 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" />
> 	<service>
> 		<provide interface="java.lang.Object" />
> 	</service>
> 	<reference 
> 		name="bundle1service" 
> 		interface="com.example.bundle1.Bundle1Service"
> 		cardinality="1..1" 
> 		policy="static" 
> 		bind="setBundle1Service" />
> </component>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira