diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java')
-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(); |