References in DS can be reluctant or greedy regarding updates. The default
is reluctant which means that once your component is active it will ignore
new services coming up.
See
https://osgi.org/javadoc/r5/cmpn/org/osgi/service/component/annotations/Reference.html

So you need to switch the policy to greedy to see the new service.

Christian

2016-11-03 5:23 GMT+01:00 <[email protected]>:

> Hi All,
>
>
>
> ·         I have written a Service API  ( with method getType() which
> simply returns a “serviceString”  in this Interface)
>
> ·         I have written FOUR Service Providers (all implementing the
> above interface)
>
> ·         I am able to get the list these FOUR services with the
> following function:
>
>     public List<String> getServices(){
>         return services.stream().map(s -> s.getType()).collect(
> Collectors.toList());
>     }
>
>
>
> ·         Now,
>
> ·         I create a FIFTH Provider (which implements the same Service
> API). Thus I implement  a getType() returning this fifth service string
> (say service5)
>
> ·         I install and run this bundle dynamically from the shell using
> install / start commands. This FIFTH service is now in active state. (as
> seen via ‘lb’ command)
>
>
>
> ·         But,
>
> ·         I am **UNABLE** to list the FIFTH service by invoking the same
> function. It still lists earlier FOUR services only (which are present in
> the RunBundle of th e project).
>
>     public List<String> getServices(){
>         return services.stream().map(s -> s.getType()).collect(
> Collectors.toList());
>     }
>
>
>
> I want the fifth service to be installed at run time. The function should
> list the fifth service as well when called/invoked post installation of the
> bundle at run time.
>
>
>
> Where am I going wrong?
>
>
>
> Thanks,
>
> Manoj
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments. WARNING: Computer viruses can be
> transmitted via email. The recipient should check this email and any
> attachments for the presence of viruses. The company accepts no liability
> for any damage caused by any virus transmitted by this email.
> www.wipro.com
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to