[
http://jira.amdatu.org/jira/browse/AMDATU-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10896#comment-10896
]
Marcel Offermans commented on AMDATU-297:
-----------------------------------------
Yes. The issue here is that once you're in the init of your component,
everything you do is "dynamic" and will be in effect immediately. What you're
seeing is that once you add the first of two extra dependencies, you
immediately see its effects. Appearantly the service you depend on is already
available, so it's injected and the component is activated using start even
before you get to add the second dependency.
The solution is to use the overloaded add(List deps) method of Component to add
both dependencies atomically.
There have been snapshots in the past where this was handled differently,
that's why this used to work but no longer does.
> With the latest Felix dep mgr required service dependencies may be null when
> start is invoked
> ---------------------------------------------------------------------------------------------
>
> Key: AMDATU-297
> URL: http://jira.amdatu.org/jira/browse/AMDATU-297
> Project: Amdatu
> Issue Type: Bug
> Components: Amdatu Core
> Affects Versions: 0.1.0
> Reporter: Ivo Ladage - van Doorn
> Assignee: Marcel Offermans
> Priority: Blocker
> Fix For: 0.1.0
>
> Attachments: AMDATU-297.zip
>
>
> With the latest 3.0.0-SNAPSHOT version committed in the Amdatu trunk (but the
> latest version in the Felix trunk as well) a new issue has been introduced
> with services already being started without their required service
> dependencies being available. This didn't happen with previous versions of
> the Felix dep mgr, as the one attached (not sure what version that is).
> The use case is this:
> - I have a two tenant aware services; Test service a and Test service b
> - Test service B defines a required dependency on Test service A in its
> init() method
> - Test service B defines a required dependency on the
> CassandraPersistenceManager in its init() method
> The problem is that the start() method of Test service B is invoked before
> Test service A is available, and so the reference to Test service A is null
> in its start() method.
> I attached two bundles with which the problem can be reproduced, also source
> code is attached.
> Reproduction steps:
> -1- Start a clean Amdatu (so empty work dir)
> -2- Copy the two test service bundles to the deploy directory
> -3- Probably the error is already visible right now ("!!!!!!!!!!!!!!!! TEST
> SERVICE A IS NULL !!!!!!!!!!!!!!").
> If not; remove bundle testservice a from the deploy directory, wait for
> it to be uninstalled, then add it again
> The problem seems to be that two required service dependencies are defined in
> the init() method of TestServiceBImpl. If I remove the
> CassandraPersistenceManager dependency, it works like a charm.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira