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-4168) Adapter services don't call callbacks for existing services when adding a required dependency after setup
Date Thu, 18 Jul 2013 07:16:49 GMT

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

Pierre De Rop commented on FELIX-4168:

ok Angelo, we probably have to do some more documentations about what is the setInstanceBound

To summarize: when a required dependency is dynamically added from an init() method, it is
necessary to configure it with setInstanceBound(true), in order to avoid having the adapter
component being stopped and restarted multiple times if the dependency is not there at the
time the init method is called.

However, and admittedly, in your testcase, the dependency S2 is already available when the
init() method is declaring the dependency. So let's keep this issue opened because it might
be necessary to do some more investigations.

PS: in the DM core implementation, in the ServiceDependencyImpl.addedService(ServiceReference
ref, Object service), if the following patch is applied line 480, then your testcase will
work without using instanceBound dependency:

                if (ds.isInstantiated() /*&& isInstanceBound()*/ && isRequired())

I have commented the isInstanceBound method, but I'm not sure for now if this patch is valid.
In the meantime, you should use "setInstanceBound(true)" when declaring required dependency
within Component's init method


> Adapter services don't call callbacks for existing services when adding a required dependency
after setup
> ---------------------------------------------------------------------------------------------------------
>                 Key: FELIX-4168
>                 URL: https://issues.apache.org/jira/browse/FELIX-4168
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-3.1.0
>            Reporter: Angelo van der Sijpt
>         Attachments: FELIX_4168AdapterWithDynamicallyAddedDependencies.java
> I have the following scenario,
> - an adapter service comes up for some underlying service;
> - some time during start (either during init(), start(), or add()), I add a required
service dependency, with callbacks;
> - the service on which we depend, is already available.
> I would expect the callbacks get called during startup of the component. However, this
doesn't happen.
> I have been able to localize this a little further,
> - this only happens when the service is already available (i.e., services that show up
later work fine),
> - the service does not get pulled because of the new dependency (which is should),
> - it doesn't matter which callback function I register the depencies from,
> - it can be solved partially by setting the required dependencies to be instanceBound(),
but then still the service doesn't get pulled before a service becomes available.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message