Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-7194

Document that AdapterManager sorts AdapterFactory implementations lowest ranking first

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • API 2.16.4
    • API 2.18.0
    • Extensions
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              sseifert Stefan Seifert
              sseifert Stefan Seifert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: