I'm surprised that that is not what you are seeing, but I do agree it is a bug in p2 if infact p2 intends to pay attention to service rankings.
Tom |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |"Carlos O'Donell" <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Thomas Watson/Austin/IBM@IBMUS, | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Cc: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |P2 developer discussions <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |08/01/2012 10:32 AM | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |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 <[email protected]> > > To: > > [email protected], > > 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 [email protected] http://wagenknecht.org/ > > _______________________________________________ p2-dev mailing list > [email protected] https://dev.eclipse.org/mailman/listinfo/p2-dev > > > > > > _______________________________________________ p2-dev mailing list > [email protected] https://dev.eclipse.org/mailman/listinfo/p2-dev > -- Carlos O'Donell Mentor Graphics / CodeSourcery [email protected] [email protected] +1 (613) 963 1026
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
_______________________________________________ p2-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/p2-dev
