A component Son is defined as a factory:

        factory = « SON »)
public class Son implements …  {

    @Reference(cardinality = ReferenceCardinality.OPTIONAL)
    volatile Filter aFilter;

The Component Son is instantiated within activate method of Father

public class Father implements Filter {
        public void valid(){
           Instantiation of Son and others from Factories

I observed that the « aFilter » field in Son instance is never updated as I
think it should.
I changed that« aFilter » field in Son  by requiring a service reference:

*    @Reference(cardinality = ReferenceCardinality.OPTIONAL)
    volatile ServiceReference<Filter> aServiceFilter;*

Doing that , during the activation of Father but BEFORE the component Son
was activated I can see  (e.g. by implementing binding method) that the
« aServiceFilter » is updated.
This implies that I need a bundle context  to dereference the field, but
while the activate method of Son component is not yet
avalaible, I must modified its activate method by adding:

*       @Activate       
                aFilter= context.getService(aServiceFilter);*

That trick is working, so my question is  « Is that a bug or normal
behavior  ? » and where can I find some insight.

Thanks in advance.


Sent from: 

To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to