Hi Scott,

The answer is really that it depends. The OSGi service registry supports the 
registration of service instances and service factories. This means that when 
you see a service registered in the service registry the instance may already 
exist, or it may only exist as a result of you getting the service. You can 
also have services registered with prototype scope, meaning that new instances 
are created each time you request one.

If you’re using Declarative Services then the most likely scenario is that the 
service is registered before it is injected and activated. This is because DS 
components are lazy by default.

Regards,

Tim

> On 26 Apr 2018, at 16:23, Leschke, Scott via osgi-dev 
> <osgi-dev@mail.osgi.org> wrote:
> 
> Question.  When a service is created and activated, at what point is it 
> available for lookup via the service registry, before or after the service is 
> injected into services depending on it? I could see arguments for either?
>  
> To clarify, if a service is created programmatically, and the new service is 
> then retrieved from the registry, has any injection of the service already 
> occurred at that point or the more likely scenario I think, you don’t really 
> know?
>  
> Regards,
>  
> Scott
> _______________________________________________
> 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