Hello Jasper,

Your terminology is confused which makes this very hard to follow.
Hopefully I have interpreted correctly, see my actual answer below.

On Thu, Dec 20, 2018 at 9:12 AM Jasper Simon <jasperxsi...@gmail.com> wrote:

> Hi,
> I’ve been trying to get my osgi component A bound to another component B.

Components do not bind to components, they bind to services. Those services
might be provided by components, or they might not.

> B already has a component C of that service bound to it, with default
> service ranking 0.

So... component A binds to a service provided by component B? And B binds
to a service provided by the component C. Effectively there is a chain, A
-> B -> C? Is that correct? If not, please try to explain more clearly.

> For this reference in A, the policy option is reluctant. B and C are in
> same bundle, A is in another bundle with a higher start level. This means
> that when the bundle with A is started, B has already bound C and will not
> bind A, even though it has a higher service ranking.

If a component is bound to a service using a reluctant reference, then that
reference will NOT be re-bound when a higher-ranked service comes along.
This is part of the definition of the reluctant policy option, see OSGi
Compendium Release 6, section 112.3.7.

> In our case, it’s not possible to change the bundles' start order.

That's fine, the functionality of your system should not depend on
something so unstable as bundle start order.

Making the reference policy option greedy is also not possible, as bundle
> B/C is imported as a dependency.

This statement does not explain why you cannot make the reference policy
greedy. Reference policy has got absolutely nothing to do with bundle


> Any thoughts?
> Kind regards,
> Jasper

Reply via email to