RFR: 8296472: Remove ObjectLocker around appendToClassPathForInstrumentation call
Coleen Phillimore
coleenp at openjdk.org
Mon Nov 7 18:36:33 UTC 2022
On Mon, 7 Nov 2022 18:29:56 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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);
>> }
>> }
>> }
>
> Yes, URLClassPath is already synchronized. I'm not 100% sure why the ObjectLocker is there but it's possible to pre-dates parallel capable class loaders so it dates from a time when findClass/loadClass were synchronized on "this".
Yes, the code's been there for forever. Thanks!
-------------
PR: https://git.openjdk.org/jdk/pull/11023
More information about the core-libs-dev
mailing list