Firstly - why do you need to rely on this? It sounds like very fragile code to 
me and you should probably consider rewriting so that you don’t need to care. 
However...

Section 112.5.7 of the compendium says that:

When binding services, the references are processed in the order in which they 
are specified in the component description. That is, target services from the 
first specified reference are bound before services from the next specified 
reference.

A static optional service will not be set if it is not satisfied, or will if it 
is. A dynamic optional service will behave the same way, but it may be unset 
and reset many times afterwards on other threads. Dynamic services should 
always be treated with care, whether they are optional or not.

Tim

> On 31 Jan 2018, at 10:50, Thomas Driessen via osgi-dev 
> <osgi-dev@mail.osgi.org> wrote:
> 
> Hi,
> 
> I searched the compendium spec but didn't find what I was looking for.
> 
> If I have a DS with multiple references to other DS
> 
> @Component
> class Example1{
> 
>     @Reference
>     Example2 e2
> 
>     @Reference
>     Example3 e3
> }
> 
> in which order are the references injected? Is there even a deterministic 
> order?
> 
> In the above example both references are static/mandatory. What happens if I 
> have a static/mandatory and a dynamic/optional one like this:
> 
> @Component
> class Example1{
> 
>     @Reference
>     Example2 e2
> 
>     @Reference
>     volatile Example3 e3
> }
> 
> Kind regards,
> Thomas
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org>
> https://mail.osgi.org/mailman/listinfo/osgi-dev 
> <https://mail.osgi.org/mailman/listinfo/osgi-dev>
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to