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

Unnecessary contention in CopyOnWriteSortedArrayThreadContextMap

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.10.0
    • 2.11.0
    • None
    • 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

              ggregory Gary D. Gregory
              dfeist Daniel Feist
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: