RFR: 8296472: Remove a JVMTI ObjectLocker

Coleen Phillimore coleenp at openjdk.org
Mon Nov 7 18:16:49 UTC 2022


On Mon, 7 Nov 2022 17:56:00 GMT, Alan Bateman <alanb at 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


More information about the core-libs-dev mailing list