defineClass(className, byte[], offset, length)。new CustomClassLoader(Thread.currentThread().getContextClassLoader())。因此,CustomClassLoader的父级是当前线程中的ClassLoader。Thread.currentThread().setContextClassLoader()用CustomClassLoader 设置了。Class.forName(String, true, the CustomClassLoader)。我怎么了?如果您需要更多信息,请在我的GitHub上找到详细的主题。
如果我有一个具有Map命名myMap和getter的类:
public Map getMap() {
synchronized(myMap) {
return myMap;
}
}
Run Code Online (Sandbox Code Playgroud)
难道getMap().put(Something)也会被同步?