[ 
https://issues.apache.org/jira/browse/FELIX-5198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler reopened FELIX-5198:
-------------------------------------

I think there is a difference between the service object and the service 
reference.
I totally agree that the service object should be regarded as valid while the 
events are sent out. However ServiceRegistration.unregister clearly states that 
no one is able to obtain the service anymore.
So I think it is correct that a service reference does not return the service 
anymore while unregistartion is in process. And without reading any details, 
for me this would be the normal behaviour.You already know that this service is 
dying, why should anyone want get a dying service?
Now, there is one problem with this, and I think this covers the use cases 
mentioned by Richard: the service event contains a service reference and it 
should be possible to get the service object through this service reference - 
as this is what the spec says. Which means that the spec is slightly 
contradicting itself: ServiceRegistration.unregister says, no one is able to 
obtain the service, the UNREGISTERING event states the opposite.

Therefore I think the slightly more correct behaviour would be: all service 
references given out, get invalidated when unregister is called - but the 
service reference passed in the event still allows access to the service.
However I assume, we might get into trouble with this as we have two 
differently behaving service reference objects for the same service 
registration while unregistering.
Not sure if its worth the effort.

> Service should not be available while being unregistered
> --------------------------------------------------------
>
>                 Key: FELIX-5198
>                 URL: https://issues.apache.org/jira/browse/FELIX-5198
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-5.4.0
>            Reporter: Carsten Ziegeler
>            Assignee: David Bosschaert
>             Fix For: framework-5.6.0
>
>         Attachments: felix-5198.patch
>
>
> Currently it is possible to get a service while it is  being unregistered - 
> if the service is get during processing of the unregistering event. This is 
> the order of events:
> a) a service (factory) is unregistered in the framework
> b) the UNREGISTERING event is sent before the service is actually 
> unregistered (this is as defined in the spec)
> c) the above event is handled synchronously, reactivating dependent components
> d) during this reactivation, some component looks up the service that is 
> unregistered in a). as this service is still registered and marked as valid, 
> it gets it
> According to ServiceRegistration.unregister the service should not be 
> available anymore while the events are sent



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to