Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1230

Remove unnecessary synchronization from registry lookup in EqualsBuilder and HashCodeBuilder

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 3.5
    • Component/s: lang.builder.*
    • Labels:
      None

      Description

      We're running into contention issues in registry lookup in EqualsBuilder and HashCodeBuilder. We believe the synchronization for the registry lookup is unnecessary. ThreadLocals are thread safe, each thread gets own value. Therefore no other thread can read or change the value of the current thread. As a consequence access to ThreadLocals does not need to be synchronized.

      Since IDKey uses object identity and the identity hashCode it does use neither EqualsBuilder nor HashCodeBuilder. This means that recursive calls to register and unregister are not possible even if the registered objects use EqualsBuilder or HashCodeBuilder. This also makes re-reading redundant.

      The issue was likely introduced in 2.5 by LANG-586 but 2.6 is the oldest version we can select.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pascalschumacher Pascal Schumacher
                Reporter:
                marschall Philippe Marschall
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: