Deadlock in java.net.URLClassLoader
Andrew Haley
aph@redhat.com
Mon Sep 5 10:52:00 GMT 2005
Tom Tromey writes:
> >>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
>
> Andrew> What happens is that one thread does ClassLoader.loadClass, which is
> Andrew> synchronized on the loader, and then URLClassLoader calls toString(),
> Andrew> which is synchronized on urlloaders.
>
> Another choice would be to simply synchronize on the loader and never
> synchronize on urlloaders. There doesn't seem to be a particular
> advantage to having two different locks here.
That sounds like an excellent soloution to the problem, and it never
occurred to me. I'll re-submit.
Andrew.
More information about the Java
mailing list