[ 
https://issues.apache.org/jira/browse/SLING-5041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15071883#comment-15071883
 ] 

Konrad Windszus commented on SLING-5041:
----------------------------------------

Fixed in [r1721731|http://svn.apache.org/r1721731].
Now both the RankedServices as well as ServiceUtil allow to give an explicit 
ordering. All methods/constructors not having the explicit order parameter 
(either ascending or descending) are deprecated.
I also clarified the javadocs.

> Clarify the order of the iterator given by RankedServices
> ---------------------------------------------------------
>
>                 Key: SLING-5041
>                 URL: https://issues.apache.org/jira/browse/SLING-5041
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>    Affects Versions: Commons OSGi 2.3.0
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>             Fix For: Commons OSGi 2.3.2
>
>
> Currently the iterator in {{RankedServices}} returns the services in the 
> ascending order from lowest to highest ranking. This is a different order 
> then being used by OSGi internally [1]. Usually you are only interested in an 
> iterator which gives you the service with the highest ranking first (because 
> that would also be the one being returned by 
> {{BundleContext.getServiceReference(...)}}).
> If we don't change the iterator logic we should at least make it clearer in 
> the Javadoc that the iterator really gives the services in ascending order of 
> their service ranking property and we should probably add a more useful 
> iterator which gives back the services with the highest ranking first.
> The issue came up in the context of SLING-5035.
> [1] - 
> https://osgi.org/javadoc/r4v42/org/osgi/framework/BundleContext.html#getServiceReference(java.lang.String)



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

Reply via email to