Thanks. Just wanted to make sure ;-)

Regards
Felix

Am 01.07.2012 um 17:00 schrieb Carsten Ziegeler:

> In general, services with higher ranking have preference over services
> with lower values. That's why we call services with lower ranking in
> the decorator case first. Decorators with a higher ranking come last
> and therefore have the final saying.
> 
> So I think everything is fine here :)
> 
> Regards
> Carsten
> 
> 2012/6/29 Felix Meschberger <[email protected]>:
>> Hi,
>> 
>> Am 28.06.2012 um 23:56 schrieb sam ”:
>> 
>>> It looks like ResourceDecorators are ordered by service.ranking property
>>> in ascending order.
>>> 
>>> @Properties({
>>>   @Property(name = Constants.SERVICE_RANKING, intValue = 10)
>>> })
>>> public class  Apple implements ResourceDecorator {
>>> ...
>>> }
>>> 
>>> @Properties({
>>>   @Property(name = Constants.SERVICE_RANKING, intValue = 20)
>>> })
>>> public class  Orange implements ResourceDecorator {
>>> ...
>>> }
>>> 
>>> 
>>> Given above,   Apple is executed first, then Orange, according to:
>>> http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/ServiceUtil.java
>>> 
>>> 
>>> This is sort of unintuitive to me because there is this:
>>> http://www.osgi.org/javadoc/r2/org/osgi/framework/Constants.html#SERVICE_RANKING
>>> The default ranking is 0. A service with a ranking of Integer.MAX_VALUE is
>>> very likely to be returned as the default service, whereas a service with a
>>> ranking of Integer.MIN_VALUE is very unlikely to be returned.
>> 
>> Don't know about how the resource decoarator services are sorted, but if 
>> ServiceUtil orders differently than implemented by ServiceReference 
>> instances, this would IMHO be a bug.
>> 
>> Can someone confirm this ?
>> 
>> Regards
>> Felix
> 
> 
> 
> -- 
> Carsten Ziegeler
> [email protected]

Reply via email to