From: chibash Date: Thu, 11 Feb 2016 15:10:20 +0000 (+0900) Subject: fixes a concurrency bug in ProxyFactory (JASSIST-259) X-Git-Tag: rel_3_21_0-java9-ea~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fee5e033b303efce0cb6d9268b5361d5e1eb1974;p=javassist.git fixes a concurrency bug in ProxyFactory (JASSIST-259) --- diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java index e6a773f5..5251b4be 100644 --- a/src/main/javassist/util/proxy/ProxyFactory.java +++ b/src/main/javassist/util/proxy/ProxyFactory.java @@ -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; }