felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clement Escoffier <clement.escoff...@gmail.com>
Subject Re: Service Rankings
Date Mon, 25 May 2009 06:58:25 GMT
Hi,


On 25.05.2009, at 08:10, Stuart McCulloch wrote:

> 2009/5/25 João Ferreira <jtjeferreira@gmail.com>
>
>> Hi
>>
>> I think i found a bug with service rankings since the comparator  
>> method
>> of service reference isn't being called. I placed a breakpoint in the
>> method and got no stop.
>
>
> you'll need to provide more details like which version of Felix  
> you're using
> and
> where you're setting the breakpoint (in trunk the  
> ServiceReference.compareTo
> implementation is actually in ServiceRegistrationImpl.java:452)
>
> also it depends how you're getting the service - if you use the bundle
> context
> method "getServiceReference(String clazz)" this definitely uses  
> compareTo
> - see the "getBestServiceReference" utility method in  
> BundleContextImpl:271
>
> but if you're using a high-level framework like iPOJO then it might  
> be using
> its
> own implementation of the ranking algorithm to sort services (the  
> compareTo
> method in ServiceReference only appeared in r4.1 of the OSGi spec,  
> before
> that the service ordering was defined in the spec but there was no  
> compareTo
> method defined in the ServiceReference interface)

Could you try an iPOJO trick: set the binding policy of your  
'requires' to 'dynamic-priority'.
So, in XML add 'policy="dynamic-priority"', in annotations add:  
policy="dynamic-priority".

If it works like this, it's a bug in the 'dynamic' binding policy :-)

Regards,

Clement


>
>
> Could someone confirm this? I'm creating the services with ipojo but i
>> dont think thats the prob since the services have the service.ranking
>> property set.
>>
>> Thanks
>> João Ferreira
>>
>
>
>
> -- 
> Cheers, Stuart


Mime
View raw message