Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2009-05-18 08:03:57 +0000
committerMartin Lippert2009-05-18 08:03:57 +0000
commitb4f2228b0e8a39865a24e27ff4427f94477fb988 (patch)
treeb0bd46d9f37ee929e1b2220d2a611836d3618347
parent3c057a2734ad9f10cf1bfa1177f763b59b151f18 (diff)
downloadrt.equinox.bundles-b4f2228b0e8a39865a24e27ff4427f94477fb988.tar.gz
rt.equinox.bundles-b4f2228b0e8a39865a24e27ff4427f94477fb988.tar.xz
rt.equinox.bundles-b4f2228b0e8a39865a24e27ff4427f94477fb988.zip
Bug 272428 - [aspects] Hangs after Scala plugin update; after force quit and manual restart, it crashes; after second manual restart, it finally runs.
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/Supplementer.java8
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/IAdaptorProvider.java2
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java29
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java12
5 files changed, 37 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
index b6c1f82ed..e191d0db7 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
@@ -5,5 +5,6 @@ Bundle-SymbolicName: org.eclipse.equinox.weaving.hook
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.eclipse.osgi;bundle-version="[3.2.0,4.0.0)"
Export-Package: org.eclipse.equinox.service.weaving,
+ org.eclipse.equinox.weaving.adaptors;x-friends:="org.eclipse.equinox.weaving.tests",
org.eclipse.equinox.weaving.hooks;x-friends:="org.eclipse.equinox.weaving.tests"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/Supplementer.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/Supplementer.java
index c6be53adc..d0a63ae32 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/Supplementer.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/Supplementer.java
@@ -13,8 +13,8 @@
package org.eclipse.equinox.service.weaving;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Bundle;
@@ -23,7 +23,7 @@ public class Supplementer {
private final ManifestElement[] supplementBundle;
- private final List<Bundle> supplementedBundles; // elements of type Bundle
+ private final Set<Bundle> supplementedBundles; // elements of type Bundle
private final Bundle supplementer;
@@ -42,7 +42,7 @@ public class Supplementer {
this.supplementBundle = supplementBundle;
this.supplementImporter = supplementImporter;
this.supplementExporter = supplementExporter;
- this.supplementedBundles = new ArrayList<Bundle>();
+ this.supplementedBundles = new HashSet<Bundle>();
}
public void addSupplementedBundle(final Bundle supplementedBundle) {
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/IAdaptorProvider.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/IAdaptorProvider.java
index 0f39fc983..89fdb41ff 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/IAdaptorProvider.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/IAdaptorProvider.java
@@ -9,4 +9,6 @@ public interface IAdaptorProvider {
public IWeavingAdaptor getHostBundleAdaptor(long bundleID);
+ public void resetAdaptor(long bundleID);
+
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java
index d37a0f973..d089a11dd 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java
@@ -238,6 +238,13 @@ public class SupplementerRegistry implements ISupplementerRegistry {
*/
public void refreshBundles(final Bundle[] bundles) {
if (this.packageAdmin != null) {
+ if (AbstractWeavingHook.verbose) {
+ for (int i = 0; i < bundles.length; i++) {
+ System.out.println("refresh bundle: "
+ + bundles[i].getSymbolicName());
+ }
+ }
+
this.packageAdmin.refreshPackages(bundles);
}
}
@@ -250,6 +257,8 @@ public class SupplementerRegistry implements ISupplementerRegistry {
removeSupplementedBundle(bundle);
this.supplementersByBundle.remove(bundle.getBundleId());
+ this.adaptorProvider.resetAdaptor(bundle.getBundleId());
+
// if this bundle supplements other bundles, remove this supplementer and update the other bundles
if (supplementers.containsKey(bundle.getSymbolicName())) {
@@ -266,7 +275,19 @@ public class SupplementerRegistry implements ISupplementerRegistry {
final Bundle[] supplementedBundles = supplementer
.getSupplementedBundles();
if (supplementedBundles != null && supplementedBundles.length > 0) {
- refreshBundles(supplementedBundles);
+ final List<Bundle> bundlesToRefresh = new ArrayList<Bundle>(
+ supplementedBundles.length);
+ for (final Bundle bundleToRefresh : supplementedBundles) {
+ if (this.adaptorProvider.getAdaptor(bundleToRefresh
+ .getBundleId()) != null) {
+ bundlesToRefresh.add(bundleToRefresh);
+ }
+ }
+
+ if (bundlesToRefresh.size() > 0) {
+ refreshBundles(bundlesToRefresh
+ .toArray(new Bundle[bundlesToRefresh.size()]));
+ }
}
// remove this supplementer from the list of supplementers per other bundle
@@ -391,12 +412,6 @@ public class SupplementerRegistry implements ISupplementerRegistry {
final Bundle[] bundles = bundlesToRefresh
.toArray(new Bundle[bundlesToRefresh.size()]);
- if (AbstractWeavingHook.verbose) {
- for (int i = 0; i < bundles.length; i++) {
- System.out.println("refresh bundle: "
- + bundles[i].getSymbolicName());
- }
- }
refreshBundles(bundles);
}
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
index a2e2f7c46..530b2762c 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingHook.java
@@ -19,10 +19,10 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
-import org.eclipse.equinox.weaving.adaptors.WeavingAdaptor;
-import org.eclipse.equinox.weaving.adaptors.WeavingAdaptorFactory;
import org.eclipse.equinox.weaving.adaptors.Debug;
import org.eclipse.equinox.weaving.adaptors.IWeavingAdaptor;
+import org.eclipse.equinox.weaving.adaptors.WeavingAdaptor;
+import org.eclipse.equinox.weaving.adaptors.WeavingAdaptorFactory;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
@@ -150,6 +150,10 @@ public class WeavingHook extends AbstractWeavingHook {
}
}
+ public void resetAdaptor(final long bundleID) {
+ this.adaptors.remove(bundleID);
+ }
+
@Override
public BundleFile wrapBundleFile(final BundleFile bundleFile,
final Object content, final BaseData data, final boolean base)
@@ -171,8 +175,8 @@ public class WeavingHook extends AbstractWeavingHook {
+ bundleFile.getBaseFile());
if (base) {
- wrapped = new BaseWeavingBundleFile(
- new BundleAdaptorProvider(data, this), bundleFile);
+ wrapped = new BaseWeavingBundleFile(new BundleAdaptorProvider(data,
+ this), bundleFile);
} else {
wrapped = new WeavingBundleFile(new BundleAdaptorProvider(data,
this), bundleFile);

Back to the top