On 10/10/2014 07:31 PM, Mandy Chung wrote:
On 10/10/2014 8:10 AM, Claes Redestad wrote:
Hi all,
please review this patch which attempts to clean up synchronization
and improve scalability when
defining and getting java.lang.Package objects.
I agree with David that getting Package objects are not performance
critical. On the other hand, the code defining/getting Packages is
old and deserves some cleanup especially the synchronization part.
I have a little more information on this subject. We've a possible (and
somewhat likely) deadlock which occurs because one thread can attempt to
define a system class while holding the java.lang.Package#pkgs lock,
while another thread can attempt to get a package while defining a
system class (while holding the class loader lock). I do not recall
whether parallel class loading alleviates this issue. We solved the
problem by loading Packages.getPackages() in early (single-threaded)
bootstrap.
So from my perspective, just getting rid of the synchronization on that
field alone makes this change worthwhile.
--
- DML