Hi Carsten,
thanks a lot for your quick response... I thought that there was a small notice 
in the spec, but I cannot find it anymore: Can I rely on the fact, that a 
component is fully activated before any service calls are made to it?

Regards,
Jens

Gesendet: Mittwoch, 01. Februar 2017 um 09:24 Uhr
Von: "Carsten Ziegeler" <cziege...@apache.org>
An: users@felix.apache.org
Betreff: Re: Order of service (un-)registration in SCR
Jens Offenbach wrote
> Hi,
> I require some advice regarding "Declarative Services". Unfortunately, I 
> cannot find anything in the specficiation. I have a component that registers 
> a service in the service registry.
>
> What is the order during component activation and deactivation regarding 
> service (un-)registration via SCR? When is the service registered and 
> unregistered in the service registry?
>
> I made a quick test and found out that the service gets registered before the 
> component is fully activated (breakpoint in "activate" method). I do not 
> expect that behaviour and what about deactivation. I would expect that the 
> service gets unregistered and afterwards the component gets deactived.
>

It's correct that the service is registered before the component is
activated. The SCR implementation registers a service factory on behalf
of the component. Only if someone is requestion the service from the
registration, the component gets activated. This is in order to support
lazy creation of the component. Otherwise SCR would need to activate all
components and maybe only half of them are used.

The service gets unregistered first and then deactivate is called,
assuming that the component has been activated in the first place.

So if no one is using your service, nothing happens wrt your component.

Regards

Carsten

--
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org

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

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

Reply via email to