Code Review Request for 6977738
mandy.chung at oracle.com
Thu Sep 16 23:30:33 UTC 2010
Fix 6977738: Deadlock between java.lang.ClassLoader and java.util.Properties
ClassLoader.getResource locking the system properties object is
deadlock prone. For example, the sun.misc.Launcher.getBootstrapClassPath()
method is a synchronized method. A thread calling
ClassLoader.getResource method attempts to synchronize on
the system properties object while holding sun.misc.Launcher.class.
It will deadlock if there is another thread is holding the monitor
lock of the system properties object (e.g. calls the Properties.save()
method) while it attempts to load a resource file. In addition,
ClassLoader.getResource may invoke the ZipFile initialization that
also needs to get the system property.
This fix caches the system properties at initialization so that
the ZipFile and Launcher will read the system property from the
private Properties object. In addition, I make some minor
changes in Properties.save and storeToXML method to confine the
synchronization needed and also have the DownloadManager to
maintain its bootclasspath.
More information about the core-libs-dev