Fix in JavaRef2>>#resolve: resolving is now synchronized on class. development
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 23 Dec 2013 23:14:49 +0100
branchdevelopment
changeset 2969 38f0943c97a4
parent 2968 d4963adcb114
child 2970 c9408352a572
Fix in JavaRef2>>#resolve: resolving is now synchronized on class.
JavaRef2.st
--- a/JavaRef2.st	Mon Dec 23 22:59:16 2013 +0100
+++ b/JavaRef2.st	Mon Dec 23 23:14:49 2013 +0100
@@ -208,18 +208,6 @@
     "Modified: / 08-04-2011 / 17:39:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
-invalidateForClass: internalJavaClassName 
-    "Invalidates receiver iff it refers (even indirectly)
-     to a class ref that has been resolved to given class.
-     Returns true, if the receiver has been invalidated,
-     false otherwise"
-
-    ^ self subclassResponsibility.
-
-    "Created: / 08-04-2011 / 15:59:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified (comment): / 21-02-2012 / 10:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 preResolve
     "Pre-resolve some caches. Called when the constant pool
      is loaded. MUST NOT load new nor modify any existing class!!!!!!
@@ -259,15 +247,19 @@
      Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything
      else."
     
-    self isResolved ifFalse: [ 
-        self findResolvedValue: doClassInit.
-        JavaVM flushCachesFor: constantPool owner.
+    self isResolved ifFalse: [
+        constantPool owner synchronized:[  
+            self isResolved ifFalse:[
+                self findResolvedValue: doClassInit.
+                JavaVM flushCachesFor: constantPool owner.
+            ].
+        ]
     ].
     ^ valueCache.
 
     "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Created: / 09-02-2012 / 23:08:15 / mh <hlopik@gmail.com>"
-    "Modified: / 17-10-2012 / 20:24:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-12-2013 / 23:02:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateClassRefsFrom: oldOwner to: newOwner