felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre De Rop (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-5045) DM Optional callbacks may sometimes be invoked before start callback
Date Thu, 24 Sep 2015 22:07:05 GMT

    [ https://issues.apache.org/jira/browse/FELIX-5045?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14907117#comment-14907117

Pierre De Rop commented on FELIX-5045:

The integration test for this issue is located in org.apache.felix.dm.itest.api.FELIX5045_OptionalDependencyCBCalledBeforeStartTest.java

> 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
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

View raw message