Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-06-25 11:44:59 -0400
committerThomas Watson2014-06-25 11:44:59 -0400
commit8581e459c136679ce04076e53872f9a4fc857cf1 (patch)
tree6999476f8c7d53a7109bcfb474e946adaaea1f75
parent4d66850b4a9dfb8d34ca90a803e8bead80293f53 (diff)
downloadrt.equinox.framework-R3_6_maintenance.tar.gz
rt.equinox.framework-R3_6_maintenance.tar.xz
rt.equinox.framework-R3_6_maintenance.zip
Bug 438169 - Equinox StateImpl thread safety bugR36x_v20150625-1200R36x_v20140625-1200R3_6_maintenance
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java62
1 files changed, 33 insertions, 29 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index 327c2581c..e27f18acb 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
@@ -573,40 +573,44 @@ public abstract class StateImpl implements State {
public ExportPackageDescription[] getExportedPackages() {
fullyLoad();
- final List allExportedPackages = new ArrayList();
- for (Iterator iter = resolvedBundles.iterator(); iter.hasNext();) {
- BundleDescription bundle = (BundleDescription) iter.next();
- ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
- if (bundlePackages == null)
- continue;
- for (int i = 0; i < bundlePackages.length; i++)
- allExportedPackages.add(bundlePackages[i]);
- }
- for (Iterator iter = removalPendings.iterator(); iter.hasNext();) {
- BundleDescription bundle = (BundleDescription) iter.next();
- ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
- if (bundlePackages == null)
- continue;
- for (int i = 0; i < bundlePackages.length; i++)
- allExportedPackages.add(bundlePackages[i]);
+ synchronized (this.monitor) {
+ final List allExportedPackages = new ArrayList();
+ for (Iterator iter = resolvedBundles.iterator(); iter.hasNext();) {
+ BundleDescription bundle = (BundleDescription) iter.next();
+ ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
+ if (bundlePackages == null)
+ continue;
+ for (int i = 0; i < bundlePackages.length; i++)
+ allExportedPackages.add(bundlePackages[i]);
+ }
+ for (Iterator iter = removalPendings.iterator(); iter.hasNext();) {
+ BundleDescription bundle = (BundleDescription) iter.next();
+ ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
+ if (bundlePackages == null)
+ continue;
+ for (int i = 0; i < bundlePackages.length; i++)
+ allExportedPackages.add(bundlePackages[i]);
+ }
+ return (ExportPackageDescription[]) allExportedPackages.toArray(new ExportPackageDescription[allExportedPackages.size()]);
}
- return (ExportPackageDescription[]) allExportedPackages.toArray(new ExportPackageDescription[allExportedPackages.size()]);
}
BundleDescription[] getFragments(final BundleDescription host) {
final List fragments = new ArrayList();
- for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) {
- BundleDescription bundle = (BundleDescription) iter.next();
- HostSpecification hostSpec = bundle.getHost();
-
- if (hostSpec != null) {
- BundleDescription[] hosts = hostSpec.getHosts();
- if (hosts != null)
- for (int i = 0; i < hosts.length; i++)
- if (hosts[i] == host) {
- fragments.add(bundle);
- break;
- }
+ synchronized (this.monitor) {
+ for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) {
+ BundleDescription bundle = (BundleDescription) iter.next();
+ HostSpecification hostSpec = bundle.getHost();
+
+ if (hostSpec != null) {
+ BundleDescription[] hosts = hostSpec.getHosts();
+ if (hosts != null)
+ for (int i = 0; i < hosts.length; i++)
+ if (hosts[i] == host) {
+ fragments.add(bundle);
+ break;
+ }
+ }
}
}
return (BundleDescription[]) fragments.toArray(new BundleDescription[fragments.size()]);

Back to the top