fix project deadlock when starting application in issue 3784 (#3894)

This commit is contained in:
于玉桔 2019-11-19 22:44:20 +08:00 committed by 吴晟 Wu Sheng
parent 6d3b0e2aeb
commit aa4ecb41e9
1 changed files with 3 additions and 2 deletions

View File

@ -63,16 +63,17 @@ public class InterceptorInstanceLoader {
Object inst = INSTANCE_CACHE.get(instanceKey);
if (inst == null) {
INSTANCE_LOAD_LOCK.lock();
ClassLoader pluginLoader;
try {
ClassLoader pluginLoader = EXTEND_PLUGIN_CLASSLOADERS.get(targetClassLoader);
pluginLoader = EXTEND_PLUGIN_CLASSLOADERS.get(targetClassLoader);
if (pluginLoader == null) {
pluginLoader = new AgentClassLoader(targetClassLoader);
EXTEND_PLUGIN_CLASSLOADERS.put(targetClassLoader, pluginLoader);
}
inst = Class.forName(className, true, pluginLoader).newInstance();
} finally {
INSTANCE_LOAD_LOCK.unlock();
}
inst = Class.forName(className, true, pluginLoader).newInstance();
if (inst != null) {
INSTANCE_CACHE.put(instanceKey, inst);
}