Uploaded image for project: 'River (Retired)'
  1. River (Retired)
  2. RIVER-396

PreferredClassProvider classloader cache concurrency improvement

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • River_2.1.2
    • River_2.2.0
    • net_jini_loader
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            cdolan Chris Dolan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: