]> source.dussan.org Git - javassist.git/commitdiff
fixes a concurrency bug in ProxyFactory (JASSIST-259)
authorchibash <chiba@javassist.org>
Thu, 11 Feb 2016 15:10:20 +0000 (00:10 +0900)
committerchibash <chiba@javassist.org>
Thu, 11 Feb 2016 15:10:20 +0000 (00:10 +0900)
src/main/javassist/util/proxy/ProxyFactory.java

index e6a773f55185e726e1312248bfb42ea135e19c1c..5251b4be14d56595e166159eb902d4611ff07aad 100644 (file)
@@ -421,20 +421,21 @@ public class ProxyFactory {
     }
 
     private Class createClass1() {
-        if (thisClass == null) {
+        Class result = thisClass;
+        if (result == null) {
             ClassLoader cl = getClassLoader();
             synchronized (proxyCache) {
                 if (factoryUseCache)
                     createClass2(cl);
                 else 
                     createClass3(cl);
+
+                result = thisClass;
+                // don't retain any unwanted references
+                thisClass = null;
             }
         }
 
-        // don't retain any unwanted references
-        Class result = thisClass;
-        thisClass = null;
-
         return result;
     }