Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Helleboid2015-01-15 09:44:37 +0000
committerThomas Watson2015-01-16 17:02:29 +0000
commit43830374c00bd7be71d2cbb79fc8f54d22495b93 (patch)
tree9e2d22e5d1e1a6ccc70b3c72e9ca114db877f1c5
parent51da3c3cee2795b388e5f709bb3cf4bf4cb4b2fc (diff)
downloadrt.equinox.framework-43830374c00bd7be71d2cbb79fc8f54d22495b93.tar.gz
rt.equinox.framework-43830374c00bd7be71d2cbb79fc8f54d22495b93.tar.xz
rt.equinox.framework-43830374c00bd7be71d2cbb79fc8f54d22495b93.zip
Bug 457118 - OutOfMemoryError (Java Heap Space) when resolving bundles
Avoid to merge duplicate exported packages see https://issues.apache.org/jira/browse/FELIX-4762 Bug: 457118 Change-Id: Ifdf099f06a83ff5b694a8a24d944c0eadc23fe75 Signed-off-by: Matthieu Helleboid <matthieu.helleboid@thalesgroup.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
index 6ada758b0..a34115dc3 100644
--- a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
@@ -732,7 +732,7 @@ public class ResolverImpl implements Resolver
mergeCandidatePackages(
session.getContext(), resource, req, cap, resourcePkgMap, allCandidates,
- new HashMap<Resource, List<Capability>>());
+ new HashMap<Resource, List<Capability>>(), new HashMap<Resource, List<Resource>>());
}
// Third, have all candidates to calculate their package spaces.
@@ -829,7 +829,7 @@ public class ResolverImpl implements Resolver
private void mergeCandidatePackages(
ResolveContext rc, Resource current, Requirement currentReq,
Capability candCap, Map<Resource, Packages> resourcePkgMap,
- Candidates allCandidates, Map<Resource, List<Capability>> cycles)
+ Candidates allCandidates, Map<Resource, List<Capability>> cycles, HashMap<Resource, List<Resource>> visitedRequiredBundlesMap)
{
List<Capability> cycleCaps = cycles.get(current);
if (cycleCaps == null)
@@ -857,17 +857,28 @@ public class ResolverImpl implements Resolver
// Get the candidate's package space to determine which packages
// will be visible to the current resource.
Packages candPkgs = resourcePkgMap.get(candCap.getResource());
-
- // We have to merge all exported packages from the candidate,
- // since the current resource requires it.
- for (Entry<String, Blame> entry : candPkgs.m_exportedPkgs.entrySet())
+
+ List<Resource> visitedRequiredBundles = visitedRequiredBundlesMap.get(current);
+ if (visitedRequiredBundles == null)
{
- mergeCandidatePackage(
- current,
- true,
- currentReq,
- entry.getValue().m_cap,
- resourcePkgMap);
+ visitedRequiredBundles = new ArrayList<Resource>();
+ visitedRequiredBundlesMap.put(current, visitedRequiredBundles);
+ }
+ if (!visitedRequiredBundles.contains(candCap.getResource()))
+ {
+ visitedRequiredBundles.add(candCap.getResource());
+
+ // We have to merge all exported packages from the candidate,
+ // since the current resource requires it.
+ for (Entry<String, Blame> entry : candPkgs.m_exportedPkgs.entrySet())
+ {
+ mergeCandidatePackage(
+ current,
+ true,
+ currentReq,
+ entry.getValue().m_cap,
+ resourcePkgMap);
+ }
}
// If the candidate requires any other bundles with reexport visibility,
@@ -893,7 +904,7 @@ public class ResolverImpl implements Resolver
w.getCapability(),
resourcePkgMap,
allCandidates,
- cycles);
+ cycles, visitedRequiredBundlesMap);
}
}
}
@@ -918,7 +929,7 @@ public class ResolverImpl implements Resolver
allCandidates.getCandidates(req).iterator().next(),
resourcePkgMap,
allCandidates,
- cycles);
+ cycles, visitedRequiredBundlesMap);
}
}
}

Back to the top