You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by "Chris Dolan (JIRA)" <ji...@apache.org> on 2011/04/13 21:06:05 UTC

[jira] [Updated] (RIVER-396) PreferredClassProvider classloader cache concurrency improvement

     [ https://issues.apache.org/jira/browse/RIVER-396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Dolan updated RIVER-396:
------------------------------

    Attachment: PreferredClassProvider.java.patch

> PreferredClassProvider classloader cache concurrency improvement
> ----------------------------------------------------------------
>
>                 Key: RIVER-396
>                 URL: https://issues.apache.org/jira/browse/RIVER-396
>             Project: River
>          Issue Type: Improvement
>          Components: net_jini_loader
>    Affects Versions: River_2.1.2
>            Reporter: Chris Dolan
>            Priority: Minor
>         Attachments: PreferredClassProvider.java.patch
>
>
> The PreferredClassProvider.lookupLoader() method uses a single coarse lock to synchronize its cache of ClassLoader instances. Because the creation of a ClassLoader can be an expensive operation (including remote calls in some special cases) this global lock can be a significant bottleneck.
> Attached is a patch to refactor that code to hold only a finer grained lock while constructing the ClassLoader in case of a cache miss.  The refactor moves the ReferenceQueue field out of any synchronized block, because that class is already thread-safe. The refactor still holds a coarse lock while checking the cache, but holds only a finer lock (per cache line) while checking and possibly creating the ClassLoader.
> See also RIVER-336 where an alternative version of this patch was proposed.  But a following analysis revealed concurrency problems with that patch: http://mail-archives.apache.org/mod_mbox/river-dev/201104.mbox/browser

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira