public List getSortedServices()

in src/main/java/org/apache/sling/commons/osgi/SortingServiceTracker.java [88:109]


    public List<T> getSortedServices() {
        List<T> result = this.sortedServiceCache;
        if ( result == null || this.lastCount < this.getTrackingCount() ) {
            this.lastCount = this.getTrackingCount();
            final ServiceReference<T>[] references = this.getServiceReferences();
            if ( references == null || references.length == 0 ) {
                result = Collections.emptyList();
            } else {
                Arrays.sort(references);
                result = new ArrayList<T>();
                for(int i=0;i<references.length;i++) {
                    @SuppressWarnings("unchecked")
                    final T service = this.getService(references[references.length - 1 - i]);
                    if ( service != null ) {
                        result.add(service);
                    }
                }
            }
            this.sortedServiceCache = result;
        }
        return result;
    }