diff options
author | mhussein | 2015-04-22 09:06:47 +0000 |
---|---|---|
committer | Pascal Rapicault | 2015-05-15 16:42:26 +0000 |
commit | adf131ab20f3266dd1d44a858957edd3b5739342 (patch) | |
tree | 04c1b9fd18155cfcf864a2ffc6cc678fa4f10708 /bundles | |
parent | dc523545d91da191ccdf7ffbf39d059172549e26 (diff) | |
download | rt.equinox.p2-adf131ab20f3266dd1d44a858957edd3b5739342.tar.gz rt.equinox.p2-adf131ab20f3266dd1d44a858957edd3b5739342.tar.xz rt.equinox.p2-adf131ab20f3266dd1d44a858957edd3b5739342.zip |
bug390470 Use ranking to select services
In 3.7.1, org.eclipse.equinox.p2.core does not select services based on
ranking.
This is a serious issue and impacts installing your own services.
This patch uses existing service.ranking property to rank services.
Check bug390470 for more details on the problems and solution.
Change-Id: I36382a260f12cb1df82be21959eb5aac97fcbd0f
Signed-off-by: mhussein <mohamed_hussein@mentor.com>
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java index 32a6a30ef..954691dce 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java @@ -51,16 +51,16 @@ public class ProvisioningAgent implements IProvisioningAgent, ServiceTrackerCust if (service != null) return service; //attempt to get factory service from service registry - Collection<ServiceReference<IAgentServiceFactory>> refs; + PriorityQueue<ServiceReference<IAgentServiceFactory>> refs; try { - refs = context.getServiceReferences(IAgentServiceFactory.class, "(" + IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + '=' + serviceName + ')'); //$NON-NLS-1$ + refs = new PriorityQueue<ServiceReference<IAgentServiceFactory>>(context.getServiceReferences(IAgentServiceFactory.class, "(" + IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + '=' + serviceName + ')')); //$NON-NLS-1$ } catch (InvalidSyntaxException e) { } catch (InvalidSyntaxException e) { e.printStackTrace(); return null; } if (refs == null || refs.isEmpty()) return null; - ServiceReference<IAgentServiceFactory> firstRef = refs.iterator().next(); + ServiceReference<IAgentServiceFactory> firstRef = refs.peek(); //track the factory so that we can automatically remove the service when the factory goes away ServiceTracker<IAgentServiceFactory, Object> tracker = new ServiceTracker<IAgentServiceFactory, Object>(context, firstRef, this); tracker.open(); |