[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Service ranking and p2's IAgentServiceFactory.

Tom,

If you are syaing that Equinox's implementation will sort by 
service.ranking, that's not what I'm seeing in 3.7.1, nor 
would I want to trust this to implementation dependent 
behaviour.

Do we agree that it is a bug in p2 not to sort the returned 
services?

On 8/1/2012 9:38 AM, Thomas Watson wrote:
> Gunnar is correct with respect to the OSGi specification.  As an
> implementation detail the snapshot of the service references returned
> by Equinox's implementation of
> BundleContext.getServiceReferences(...) will be sorted according to
> the service ranking at the time of the call such that the first
> element in the array (or Collection interator) will be the highest
> ranked service.
> 
> Tom
> 
> 
> 
> Inactive hide details for Gunnar Wagenknecht ---08/01/2012 03:17:21
> AM---Am 01.08.2012 04:48, schrieb Mengxin Zhu:Gunnar Wagenknecht
> ---08/01/2012 03:17:21 AM---Am 01.08.2012 04:48, schrieb Mengxin
> Zhu:
> 
> 
> From:
> 
>  Gunnar Wagenknecht <gunnar@xxxxxxxxxxxxxxx>
> 
> To:
> 
>  p2-dev@xxxxxxxxxxx,
> 
> Date:
> 
>  08/01/2012 03:17 AM
> 
> Subject:
> 
>  Re: [p2-dev] Service ranking and p2's IAgentServiceFactory.
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> 
> 
> 
> Am 01.08.2012 04:48, schrieb Mengxin Zhu:
>> P2 is searching services via OSGi API that would sort the service 
>> implementations by their ranking.
> 
> At least in the code snippets posted p2 uses 
> BundleContext#getServiceReferences(...). Nothing in the contract of 
> those methods states that the result returned is sorted in any way.
> One either needs sort the results (ServiceReference implements
> Comparable) or switch to using a ServiceTracker which honors service
> ranking in ServiceTracker#getServiceReference().
> 
> -Gunnar
> 
> 
> 
> -- Gunnar Wagenknecht gunnar@xxxxxxxxxxxxxxx http://wagenknecht.org/
> 
> _______________________________________________ p2-dev mailing list 
> p2-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/p2-dev
> 
> 
> 
> 
> 
> _______________________________________________ p2-dev mailing list 
> p2-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/p2-dev
> 


-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell@xxxxxxxxxx
carlos@xxxxxxxxxxxxxxxx
+1 (613) 963 1026