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

ASF GitHub Bot commented on SLING-7194:
---------------------------------------

kwin commented on a change in pull request #1: SLING-7194 AdapterManager sorts 
AdapterFactory implementations lowest ranking first
URL: 
https://github.com/apache/sling-org-apache-sling-adapter/pull/1#discussion_r155640841
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptorMap.java
 ##########
 @@ -41,4 +42,16 @@
 
     private static final long serialVersionUID = 2L;
 
+    public AdapterFactoryDescriptorMap() {
+        super(new Comparator<ServiceReference<AdapterFactory>>() {
 
 Review comment:
   Sorry, you are right. I guess in this module we still need to support older 
Java versions.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> AdapterManager sorts AdapterFactory implementations lowest ranking first
> ------------------------------------------------------------------------
>
>                 Key: SLING-7194
>                 URL: https://issues.apache.org/jira/browse/SLING-7194
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Adapter 2.1.10
>            Reporter: Stefan Seifert
>
> the current implementation of AdapterManager uses a 
> AdapterFactoryDescriptorMap to sort the AdapterFactory implementations found.
> this is done using a TreeMap with the ServiceReference as key. 
> ServiceReference implements a compareTo.
> according to its documentation the default implementation sorts with 
> service-ranking lowest-first/service id highest-first:
> https://osgi.org/javadoc/r6/core/org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)
> when picking a service from multiple ones using BundleContext.getService, the 
> service with hightest service ranking/lowest service id is returned.
> i would expect the same from the AdapterManager implementation - if multiple 
> implementations match pick that one with highest ranking/lowest service id.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to