Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2016-06-07 13:26:50 +0000
committerStephan Herrmann2016-06-07 13:26:50 +0000
commit2161c877ff9578003d1d7742527ab9c2b8af02c8 (patch)
tree05747b2aedce50ee63fd853c49a85dd4cbda82f4
parentfc3bca2928ce7896dc217cdc9ed5bc793f188d92 (diff)
downloadorg.eclipse.objectteams-2161c877ff9578003d1d7742527ab9c2b8af02c8.tar.gz
org.eclipse.objectteams-2161c877ff9578003d1d7742527ab9c2b8af02c8.tar.xz
org.eclipse.objectteams-2161c877ff9578003d1d7742527ab9c2b8af02c8.zip
Bug 495595: [otdre] race condition: class can be defined unwoven while
being woven in another thread
-rw-r--r--plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/transformer/jplis/ObjectTeamsTransformer.java39
1 files changed, 21 insertions, 18 deletions
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/transformer/jplis/ObjectTeamsTransformer.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/transformer/jplis/ObjectTeamsTransformer.java
index 07cd1de0e..f97218b2f 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/transformer/jplis/ObjectTeamsTransformer.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/transformer/jplis/ObjectTeamsTransformer.java
@@ -89,26 +89,29 @@ public class ObjectTeamsTransformer implements ClassFileTransformer {
if (clazz == null)
clazz = classRepo.getBoundClass(sourceClassName, classId, loader);
- if (classBeingRedefined == null && !clazz.isFirstTransformation()) {
- return clazz.getBytecode(); // FIXME: re-loading existing class?? Investigate classloader, check classId strategy etc.pp.
- }
- try {
- if (clazz.isTransformationActive()) {
- return null;
+
+ synchronized(clazz) { // all modifications done in this critical section
+ if (classBeingRedefined == null && !clazz.isFirstTransformation()) {
+ return clazz.getBytecode();
+ }
+ try {
+ if (clazz.isTransformationActive()) {
+ return null;
+ }
+ clazz = classRepo.getBoundClass(
+ className, classId, classfileBuffer, loader);
+ clazz.setWeavingContext(this.weavingContext);
+ if (!clazz.isInterface())
+ classRepo.linkClassWithSuperclass(clazz);
+ if (!clazz.isInterface() || clazz.isRole())
+ clazz.transformAtLoadTime();
+
+ classfileBuffer = clazz.getBytecode();
+ } catch(Throwable t) {
+ t.printStackTrace();
}
- clazz = classRepo.getBoundClass(
- className, classId, classfileBuffer, loader);
- clazz.setWeavingContext(this.weavingContext);
- if (!clazz.isInterface())
- classRepo.linkClassWithSuperclass(clazz);
- if (!clazz.isInterface() || clazz.isRole())
- clazz.transformAtLoadTime();
-
- classfileBuffer = clazz.getBytecode();
- clazz.dump(classfileBuffer, "initial");
- } catch(Throwable t) {
- t.printStackTrace();
}
+ clazz.dump(classfileBuffer, "initial");
Collection<String> boundBaseClasses = clazz.getBoundBaseClasses();
if (boundBaseClasses != null)

Back to the top