Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2212

Unnecessary contention in CopyOnWriteSortedArrayThreadContextMap

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.10.0
    • Fix Version/s: 2.11.0
    • Component/s: None
    • Labels:
      None

      Description

      The following method retrieves the value of a system property for each and every map that is created.  While maps are cached/reused where possible via thread local this method is still used a lot in runtime.

      protected StringMap createStringMap() {
        return new SortedArrayStringMap(PropertiesUtil.getProperties().getIntegerPropertyPROPERTY_NAME_INITIAL_CAPACITY, DEFAULT_INITIAL_CAPACITY));
      }

      Under concurrency, this introduces unnecessary contention due to java.util.Properties monitor in HashTable.contains when retrieving system property, as seen below.


       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                garydgregory Gary Gregory
                Reporter:
                dfeist Daniel Feist
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: