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

Felix Meschberger closed FELIX-950.
-----------------------------------

    Resolution: Fixed

Implemented the fix in Rev. 745981:

* A bound service is replaced if a service with a higher ranking is registered. 
Replacement takes place as specified by first binding the new service and then 
unbinding the replaced service.

* When accessing a single service, either through 
ComponentContext.locateService, or when first binding a service to a component, 
ensure that the service with the highest service ranking is bound.

These changes have no effect for multiple service references, since in this 
case always all services are bound.

> service.ranking property not respected for singular service reference
> ---------------------------------------------------------------------
>
>                 Key: FELIX-950
>                 URL: https://issues.apache.org/jira/browse/FELIX-950
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.0.6
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-1.0.8
>
>
> For a service reference with singular cardinality (0..1 or 1..1), the service 
> ranking has to be applied as per the service.ranking and service.id 
> properties as defined in section 112.3.2, Reference Cardinality, of the OSGi 
> Compendium Specification.
> Currently the service.ranking property is never obeyed resulting in the 
> following non-conforming situations:
> * If a service is bound and a new service is registered with a higher 
> service.ranking, the bound service is not replaced. Correct is to replace the 
> bound service with the new service.
> * If multiple services are registered, the service with the highest ranking 
> (or the lowest id for equal rankings) must be bound. Currently, the first 
> service returned by BundleContext.getServiceReferences(String, String) is 
> returned. Since this method is not specified to return the services in any 
> order, the wrong service is almost certainly selected.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to