[
https://issues.apache.org/jira/browse/SLING-5041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konrad Windszus updated SLING-5041:
-----------------------------------
Description:
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)
was:
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 is ascending order of the service ranking and
we should probably add a more usefull iterator which gives back the services in
the ranking which is also considered by OSGi.
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)
> 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
>
> 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)