diff options
author | DJ Houghton | 2011-11-16 21:49:57 +0000 |
---|---|---|
committer | DJ Houghton | 2011-11-16 21:49:57 +0000 |
commit | 4d9e215ef3fb0543f601ebd97cebfdac9dd98910 (patch) | |
tree | 60ba8f62072f0ce68c5278b92f19868277dfb2b0 | |
parent | 6e02e3fb7c4f4cec65345eb46e84490648c970f8 (diff) | |
download | rt.equinox.p2-4d9e215ef3fb0543f601ebd97cebfdac9dd98910.tar.gz rt.equinox.p2-4d9e215ef3fb0543f601ebd97cebfdac9dd98910.tar.xz rt.equinox.p2-4d9e215ef3fb0543f601ebd97cebfdac9dd98910.zip |
Bug 363963 - Provide ability to adjust default projector timeout value
Bug 363965 - [planner] Resolution is not stable
-rw-r--r-- | bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java index 48c07561c..fee3c14d4 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2011 IBM Corporation and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -177,7 +177,22 @@ public class Projector { } else { solver = SolverFactory.newEclipseP2(); } - solver.setTimeoutOnConflicts(1000); + int timeout = 1000; + String timeoutString = null; + try { + // allow the user to specify a longer timeout. + // only set the value if it is a positive integer larger than the default. + // see https://bugs.eclipse.org/336967 + timeoutString = DirectorActivator.context.getProperty("eclipse.p2.projector.timeout"); //$NON-NLS-1$ + if (timeoutString != null) + timeout = Math.max(timeout, Integer.parseInt(timeoutString)); + } catch (Exception e) { + // intentionally catch all errors (npe, number format, etc) + // print out to syserr and fall through + System.err.println("Ignoring user-specified 'eclipse.p2.projector.timeout' value of: " + timeoutString); //$NON-NLS-1$ + e.printStackTrace(); + } + solver.setTimeoutOnConflicts(timeout); IQueryResult<IInstallableUnit> queryResult = picker.query(QueryUtil.createIUAnyQuery(), null); if (DEBUG_ENCODING) { dependencyHelper = new DependencyHelper<Object, Explanation>(solver, false); @@ -268,23 +283,19 @@ public class Projector { BigInteger maxWeight = POWER; for (Entry<String, Map<Version, IInstallableUnit>> entry : s) { - Map<Version, IInstallableUnit> conflictingEntries = entry.getValue(); - - List<IInstallableUnit> toSort = new ArrayList<IInstallableUnit>(conflictingEntries.values()); + List<IInstallableUnit> conflictingEntries = new ArrayList<IInstallableUnit>(entry.getValue().values()); if (conflictingEntries.size() == 1) { - IInstallableUnit iu = toSort.get(0); + IInstallableUnit iu = conflictingEntries.get(0); if (iu != metaIu) { weightedObjects.add(WeightedObject.newWO(iu, POWER)); } continue; } - Collections.sort(toSort, Collections.reverseOrder()); + Collections.sort(conflictingEntries, Collections.reverseOrder()); BigInteger weight = POWER; - int count = toSort.size(); boolean installedIuMet = false; boolean rootedMet = false; - for (int i = 0; i < count; i++) { - IInstallableUnit iu = toSort.get(i); + for (IInstallableUnit iu : conflictingEntries) { if (!rootedMet && isInstalled(iu) && !transitiveClosure.contains(iu)) { installedIuMet = true; weightedObjects.add(WeightedObject.newWO(iu, BigInteger.ONE)); |