Deadlock in java.net.URLClassLoader

Tom Tromey tromey@redhat.com
Mon Aug 22 17:47:00 GMT 2005


>>>>> "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.

Tom



More information about the Java mailing list