On Mon, 7 Nov 2022 17:56:00 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> This patch moves the acquisition of the boot class loader lock out of the >> JVM and into the Java function. >> Tested with tier1-4, and jvmti and jdi tests locally. > > src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java line 204: > >> 202: * @see >> java.lang.instrument.Instrumentation#appendToSystemClassLoaderSearch >> 203: */ >> 204: synchronized void appendToClassPathForInstrumentation(String >> path) { > > We might not need this. appendClasspath is thread safe so it's okay for > several agents calling appendToSystemClassLoaderSearch at around the same > time. I don't think it needs to sycnrhonize with anything else. I traced it down to this: Is this why it's already synchronized ? appendClassPath -> ucp.addFile -> addURL public synchronized void addURL(URL url) { if (closed || url == null) return; synchronized (unopenedUrls) { if (! path.contains(url)) { unopenedUrls.addLast(url); path.add(url); } } } ------------- PR: https://git.openjdk.org/jdk/pull/11023