You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2015/11/30 13:55:11 UTC

[jira] [Closed] (FELIX-5045) DM Optional callbacks may sometimes be invoked before start callback

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

Pierre De Rop closed FELIX-5045.
--------------------------------

> DM Optional callbacks may sometimes be invoked before start callback
> --------------------------------------------------------------------
>
>                 Key: FELIX-5045
>                 URL: https://issues.apache.org/jira/browse/FELIX-5045
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions:  	org.apache.felix.dependencymanager-r5
>            Reporter: Pierre De Rop
>            Assignee: Pierre De Rop
>             Fix For: org.apache.felix.dependencymanager-r6
>
>
> We just found a corner case that triggers optional dependency callbacks before the component is invoked in its 'start' lifecycel callback. This is a bug, because in DM, optional dependency callbacks should be always invoked after the component's 'start' lifecycle callback.
> I'm describing now the use case: we have the following component players: 
> - B: a simple service component.
> - BFactory: a service that has a 'create' method which registers in the OSGi registry a new B service instance.
> - A: a component that adds from A.init() lifecycle callback a required dependency (with a callback) on BFactory, as well as an optional dependency (with a callback) on B.
> - when A.bind(BFactory factory) is called, it then calls "factory.create()" method which triggers the registration of the B Service.  At this point, A.bind(B b) is then invoked, but the A.start() lifecycle callback has not yet been called. This is because we are currently transiting from INSTANTIATED_AND_WAITING_FOR_REQUIRED -> TRACKING_OPTIONAL; so the current state is TRACKING_OPTIONAL, and we are calling the             invokeAddRequiredInstanceBoundDependencies()
> method, which calls A.bind(BFactory) method, which synchronously registers a B service instance; so this ends up calling the handleAdded method, which invoke A.bind(B b) method, but at this point we have not yet called the A.start() callback.
> - then "A.start()" is called.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)