Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[osgi-users] Declarative Service Curiosity

Hi,

I have a bit of an odd Situation and I'm not sure if I have a faulty expectation:

I have 2 Components:

@Component(immediate = true, property = Condition.CONDITION_ID + "=" + CONDITION_EQUINOX_CONFIG)
public class EquinoxConfigInitializerImpl implements Condition {
    @Activate
    public void activate(ComponentContext ctx) {
        // some code here
    }
}

I have a second component that does require this Condition to be there and to be activated. It does not need to be injected, so I reference it only in the annotation.

@Component(immediate=true , reference = {
    @Reference(name = "equinoxConfig", service = Condition.class, policy=ReferencePolicy.STATIC, cardinality=ReferenceCardinality.MANDATORY, target = "(" + Condition.CONDITION_ID + "=" + CONDITION_EQUINOX_CONFIG + ")")
} )

public class Component2 { ... }

My expectation thus has been, that the EquinoxConfigInitializerImpl would have been activated before Component2. For some reason this is not the case and it is activated after Component2. I couldn't really find something concrete in the Spec that lead me to a definitive answer.

Am I wrong, is this undefined or did I find a Bug in SCR (2.1.16)?

Regards,

Jürgen.

--
Jürgen Albert
CEO
Chair Eclipse OSGi Working Group Steering Committee


Data In Motion Consulting GmbH

Kahlaische Str. 4
07745 Jena

Mobil:  +49 157-72521634
E-Mail: j.albert@xxxxxxxxxxxxxxx
Web: www.datainmotion.de

XING:   https://www.xing.com/profile/Juergen_Albert5
LinkedIn: https://www.linkedin.com/in/juergen-albert-6a1796/

Rechtliches

Jena HBR 513025



Back to the top