aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2013-03-18 09:45:13 (EDT)
committerMartin Lippert2013-03-18 09:45:13 (EDT)
commitfac6218518c98999a0ef98b493d7633e8e4df2c4 (patch)
tree2f145957f0fa391b2b6e6b7601a121f63c97dfb9
parentcfd4cb434f5a61478b84993e76194ae37a965221 (diff)
downloadrt.equinox.bundles-fac6218518c98999a0ef98b493d7633e8e4df2c4.zip
rt.equinox.bundles-fac6218518c98999a0ef98b493d7633e8e4df2c4.tar.gz
rt.equinox.bundles-fac6218518c98999a0ef98b493d7633e8e4df2c4.tar.bz2
Bug 227029 - initialize mechanics were not thread safe, introduced lock object to fix this
-rw-r--r--bundles/org.eclipse.equinox.weaving.aspectj/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.weaving.aspectj/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java29
3 files changed, 16 insertions, 17 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.weaving.aspectj/META-INF/MANIFEST.MF
index f3ca54f..6def945 100644
--- a/bundles/org.eclipse.equinox.weaving.aspectj/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.weaving.aspectj/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WeavingService Plug-in (Incubation)
Bundle-SymbolicName: org.eclipse.equinox.weaving.aspectj
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.300.qualifier
Bundle-Activator: org.eclipse.equinox.weaving.aspectj.AspectJWeavingActivator
Import-Package: org.aspectj.weaver;version="1.6.3";resolution:=optional,
org.aspectj.weaver.loadtime;version="1.6.3";resolution:=optional,
diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/pom.xml b/bundles/org.eclipse.equinox.weaving.aspectj/pom.xml
index 102ac14..b607818 100644
--- a/bundles/org.eclipse.equinox.weaving.aspectj/pom.xml
+++ b/bundles/org.eclipse.equinox.weaving.aspectj/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.weaving.aspectj</artifactId>
- <version>1.0.200-SNAPSHOT</version>
+ <version>1.0.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java
index 5fe35d8..b335b15 100644
--- a/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java
+++ b/bundles/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java
@@ -125,7 +125,7 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor {
private boolean initialized;
- private boolean initializing;
+ private final Object initializeLock = new Object();
private final String namespace;
@@ -229,29 +229,29 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor {
* initialize the weaving adaptor
*/
public void initialize() {
- if (!initializing) {
+ synchronized (initializeLock) {
if (!initialized) {
- initializing = true;
super.initialize(classLoader, weavingContext);
this.generatedClassHandler = new OSGiGeneratedClassHandler(
classLoader);
initialized = true;
- initializing = false;
if (AspectJWeavingStarter.verbose) {
- if (isEnabled())
+ if (isEnabled()) {
System.err
.println("[org.eclipse.equinox.weaving.aspectj] info weaving bundle '"
+ weavingContext.getClassLoaderName()
+ "'");
- else
+ } else {
System.err
.println("[org.eclipse.equinox.weaving.aspectj] info not weaving bundle '"
+ weavingContext.getClassLoaderName()
+ "'");
+ }
}
}
}
+
}
/**
@@ -263,23 +263,22 @@ public class OSGiWeavingAdaptor extends ClassLoaderWeavingAdaptor {
final boolean mustWeave) throws IOException {
/* Avoid recursion during adaptor initialization */
- if (!initializing) {
+ synchronized (initializeLock) {
if (!initialized) {
- initializing = true;
super.initialize(classLoader, weavingContext);
this.generatedClassHandler = new OSGiGeneratedClassHandler(
classLoader);
initialized = true;
- initializing = false;
- }
-
- synchronized (this) {
- bytes = super.weaveClass(name, bytes, mustWeave);
}
+ }
- ((OSGiGeneratedClassHandler) this.generatedClassHandler)
- .defineGeneratedClasses();
+ synchronized (this) {
+ bytes = super.weaveClass(name, bytes, mustWeave);
}
+
+ ((OSGiGeneratedClassHandler) this.generatedClassHandler)
+ .defineGeneratedClasses();
+
return bytes;
}