Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2015-04-17 20:55:33 +0000
committerThomas Watson2015-04-17 20:55:33 +0000
commitf12173bac6175be732dfe42dc8ffb45ccbf68652 (patch)
treee1462d0f6e2030566d9863a287d9102601e8b901
parent1a8689effb7e188e7a8fc2af1c1df95c5afb55b8 (diff)
downloadrt.equinox.framework-f12173bac6175be732dfe42dc8ffb45ccbf68652.tar.gz
rt.equinox.framework-f12173bac6175be732dfe42dc8ffb45ccbf68652.tar.xz
rt.equinox.framework-f12173bac6175be732dfe42dc8ffb45ccbf68652.zip
Bug 464084 - Update the felix resolver implementation to the latest
- update to use the term delta
-rw-r--r--bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java31
-rw-r--r--bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java7
2 files changed, 23 insertions, 15 deletions
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
index e5501d488..8ab895c8d 100644
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
@@ -73,7 +73,7 @@ class Candidates
private final Map<Capability, Requirement> m_subtitutableMap;
- private final OpenHashMapSet<Requirement, Capability> m_path;
+ private final OpenHashMapSet<Requirement, Capability> m_delta;
/**
* Private copy constructor used by the copy() method.
@@ -86,7 +86,7 @@ class Candidates
boolean fragmentsPresent,
Map<Resource, Boolean> onDemandResources,
Map<Capability, Requirement> substitutableMap,
- OpenHashMapSet<Requirement, Capability> path)
+ OpenHashMapSet<Requirement, Capability> delta)
{
m_mandatoryResources = mandatoryResources;
m_dependentMap = dependentMap;
@@ -96,7 +96,7 @@ class Candidates
m_fragmentsPresent = fragmentsPresent;
m_validOnDemandResources = onDemandResources;
m_subtitutableMap = substitutableMap;
- m_path = path;
+ m_delta = delta;
}
/**
@@ -111,11 +111,16 @@ class Candidates
m_populateResultCache = new LinkedHashMap<Resource, Object>();
m_validOnDemandResources = validOnDemandResources;
m_subtitutableMap = new LinkedHashMap<Capability, Requirement>();
- m_path = new OpenHashMapSet<Requirement, Capability>(3);
+ m_delta = new OpenHashMapSet<Requirement, Capability>(3);
}
- public Object getPath() {
- return m_path;
+ /**
+ * Returns the delta which is the differences in the candidates from the
+ * original Candidates permutation.
+ * @return the delta
+ */
+ public Object getDelta() {
+ return m_delta;
}
/**
@@ -834,11 +839,11 @@ class Candidates
{
m_candidateMap.remove(req);
}
- // Update resolution path
- CopyOnWriteSet<Capability> capPath = m_path.get(req);
+ // Update the delta with the removed capability
+ CopyOnWriteSet<Capability> capPath = m_delta.get(req);
if (capPath == null) {
capPath = new CopyOnWriteSet<Capability>();
- m_path.put(req, capPath);
+ m_delta.put(req, capPath);
}
capPath.add(cap);
}
@@ -847,11 +852,11 @@ class Candidates
{
List<Capability> l = m_candidateMap.get(req);
l.removeAll(caps);
- // Update resolution path
- CopyOnWriteSet<Capability> capPath = m_path.get(req);
+ // Update candidates delta with the removed capabilities.
+ CopyOnWriteSet<Capability> capPath = m_delta.get(req);
if (capPath == null) {
capPath = new CopyOnWriteSet<Capability>();
- m_path.put(req, capPath);
+ m_delta.put(req, capPath);
}
capPath.addAll(caps);
return l;
@@ -1272,7 +1277,7 @@ class Candidates
m_fragmentsPresent,
m_validOnDemandResources,
m_subtitutableMap,
- m_path.deepClone());
+ m_delta.deepClone());
}
public void dump(ResolveContext rc)
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
index 381240b94..2264826a8 100644
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
@@ -208,7 +208,7 @@ public class ResolverImpl implements Resolver
}
}
- Set<Object> donePaths = new HashSet<Object>();
+ Set<Object> processedDeltas = new HashSet<Object>();
Map<Resource, ResolutionException> faultyResources = null;
do
{
@@ -221,8 +221,11 @@ public class ResolverImpl implements Resolver
{
break;
}
- if (!donePaths.add(allCandidates.getPath()))
+ // The delta is used to detect that we have already processed this particular permutation
+ if (!processedDeltas.add(allCandidates.getDelta()))
{
+ // This permutation has already been tried
+ // Don't try it again
continue;
}

Back to the top