Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2008-10-27 21:22:02 +0000
committerMartin Lippert2008-10-27 21:22:02 +0000
commita57ca36b3d8525256312f20fb1b1d22deacad2c7 (patch)
tree04b5c76555b7157530a642d698ed02b33f62bf05
parent4b6264639462a12262493d3e5d969aa8c55e2df3 (diff)
downloadrt.equinox.bundles-a57ca36b3d8525256312f20fb1b1d22deacad2c7.tar.gz
rt.equinox.bundles-a57ca36b3d8525256312f20fb1b1d22deacad2c7.tar.xz
rt.equinox.bundles-a57ca36b3d8525256312f20fb1b1d22deacad2c7.zip
Bug 249613 - [aspects] Deadlock when using equinox aspects and spring dm extender
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptor.java132
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/IAspectJAdaptor.java2
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java1
3 files changed, 70 insertions, 65 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptor.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptor.java
index f16035ba1..988656d1c 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptor.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptor.java
@@ -54,6 +54,7 @@ public class AspectJAdaptor implements IAspectJAdaptor {
set.remove(obj);
}
+ @Override
protected Object initialValue() {
return new HashSet();
}
@@ -108,6 +109,71 @@ public class AspectJAdaptor implements IAspectJAdaptor {
return cacheEntry;
}
+ public void initialize() {
+ synchronized (this) {
+ if (initialized) return;
+
+ this.bundle = data.getBundle();
+ this.symbolicName = data.getSymbolicName();
+ if (!identifyRecursionSet.contains(this)) {
+ identifyRecursionSet.put(this);
+
+ if (Debug.DEBUG_GENERAL)
+ Debug.println("> AspectJAdaptor.initialize() bundle="
+ + symbolicName + ", baseLoader=" + baseLoader);
+
+ if (symbolicName.startsWith("org.aspectj")) {
+ if (Debug.DEBUG_GENERAL)
+ Debug
+ .println("- AspectJAdaptor.initialize() symbolicName="
+ + symbolicName
+ + ", baseLoader="
+ + baseLoader);
+ } else if (baseLoader != null) {
+ weavingService = factory.getWeavingService(baseLoader);
+ cachingService = factory.getCachingService(baseLoader,
+ bundle, weavingService);
+ } else if (bundle instanceof BundleFragment) {
+ final BundleFragment fragment = (BundleFragment) bundle;
+ final BundleHost host = (BundleHost) factory
+ .getHost(fragment);
+ if (Debug.DEBUG_GENERAL)
+ Debug
+ .println("- AspectJAdaptor.initialize() symbolicName="
+ + symbolicName + ", host=" + host);
+
+ final BaseData hostData = (BaseData) host.getBundleData();
+ // System.err.println("? AspectJAdaptor.initialize() bundleData=" + hostData);
+ final BundleFile bundleFile = hostData.getBundleFile();
+ if (bundleFile instanceof AspectJBundleFile) {
+ final AspectJBundleFile hostFile = (AspectJBundleFile) bundleFile;
+ // System.err.println("? AspectJAdaptor.initialize() bundleFile=" + hostFile);
+ final AspectJAdaptor hostAdaptor = (AspectJAdaptor) hostFile
+ .getAdaptor();
+ // System.err.println("? AspectJAdaptor.initialize() bundleFile=" + hostAdaptor);
+ weavingService = hostAdaptor.weavingService;
+ cachingService = factory.getCachingService(
+ hostAdaptor.baseLoader, bundle, weavingService);
+ }
+ } else {
+ if (Debug.DEBUG_GENERAL)
+ Debug
+ .println("W AspectJAdaptor.initialize() symbolicName="
+ + symbolicName
+ + ", baseLoader="
+ + baseLoader);
+ }
+ initialized = true;
+ identifyRecursionSet.remove(this);
+ }
+
+ if (Debug.DEBUG_GENERAL)
+ Debug.println("< AspectJAdaptor.initialize() weavingService="
+ + (weavingService != null) + ", cachingService="
+ + (cachingService != null));
+ }
+ }
+
public void setBaseClassLoader(final BaseClassLoader baseClassLoader) {
this.baseLoader = baseClassLoader;
@@ -151,6 +217,7 @@ public class AspectJAdaptor implements IAspectJAdaptor {
return stored;
}
+ @Override
public String toString() {
return "AspectJAdaptor[" + symbolicName + "]";
}
@@ -177,69 +244,4 @@ public class AspectJAdaptor implements IAspectJAdaptor {
return newBytes;
}
- private void initialize() {
- synchronized (this) {
- if (initialized) return;
-
- this.bundle = data.getBundle();
- this.symbolicName = data.getSymbolicName();
- if (!identifyRecursionSet.contains(this)) {
- identifyRecursionSet.put(this);
-
- if (Debug.DEBUG_GENERAL)
- Debug.println("> AspectJAdaptor.initialize() bundle="
- + symbolicName + ", baseLoader=" + baseLoader);
-
- if (symbolicName.startsWith("org.aspectj")) {
- if (Debug.DEBUG_GENERAL)
- Debug
- .println("- AspectJAdaptor.initialize() symbolicName="
- + symbolicName
- + ", baseLoader="
- + baseLoader);
- } else if (baseLoader != null) {
- weavingService = factory.getWeavingService(baseLoader);
- cachingService = factory.getCachingService(baseLoader,
- bundle, weavingService);
- } else if (bundle instanceof BundleFragment) {
- final BundleFragment fragment = (BundleFragment) bundle;
- final BundleHost host = (BundleHost) factory
- .getHost(fragment);
- if (Debug.DEBUG_GENERAL)
- Debug
- .println("- AspectJAdaptor.initialize() symbolicName="
- + symbolicName + ", host=" + host);
-
- final BaseData hostData = (BaseData) host.getBundleData();
- // System.err.println("? AspectJAdaptor.initialize() bundleData=" + hostData);
- final BundleFile bundleFile = hostData.getBundleFile();
- if (bundleFile instanceof AspectJBundleFile) {
- final AspectJBundleFile hostFile = (AspectJBundleFile) bundleFile;
- // System.err.println("? AspectJAdaptor.initialize() bundleFile=" + hostFile);
- final AspectJAdaptor hostAdaptor = (AspectJAdaptor) hostFile
- .getAdaptor();
- // System.err.println("? AspectJAdaptor.initialize() bundleFile=" + hostAdaptor);
- weavingService = hostAdaptor.weavingService;
- cachingService = factory.getCachingService(
- hostAdaptor.baseLoader, bundle, weavingService);
- }
- } else {
- if (Debug.DEBUG_GENERAL)
- Debug
- .println("W AspectJAdaptor.initialize() symbolicName="
- + symbolicName
- + ", baseLoader="
- + baseLoader);
- }
- initialized = true;
- identifyRecursionSet.remove(this);
- }
-
- if (Debug.DEBUG_GENERAL)
- Debug.println("< AspectJAdaptor.initialize() weavingService="
- + (weavingService != null) + ", cachingService="
- + (cachingService != null));
- }
- }
-
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/IAspectJAdaptor.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/IAspectJAdaptor.java
index b5cf7ebe9..05f84c84d 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/IAspectJAdaptor.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/IAspectJAdaptor.java
@@ -21,6 +21,8 @@ public interface IAspectJAdaptor {
public CacheEntry findClass(String name, URL sourceFileURL);
+ public void initialize();
+
public void setBaseClassLoader(BaseClassLoader baseClassLoader);
public boolean storeClass(String name, URL sourceFileURL, Class clazz,
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
index 2f47075e4..54ded0c7e 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
@@ -90,6 +90,7 @@ public class AspectJHook extends AbstractAspectJHook {
final IAspectJAdaptor adaptor = createAspectJAdaptor(data);
adaptor.setBaseClassLoader(baseClassLoader);
+ adaptor.initialize();
this.adaptors.put(data.getBundleID(), adaptor);
if (Debug.DEBUG_GENERAL)

Back to the top