Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-469

Use ReentrantReadWriteLock in AbstractConnPool

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: HttpCore

      Description

      AbstractConnPool is currently using a ReentrantLock which has to lock for read and write operations. Switching to ReentrantReadWriteLock[1] and read locks for the stats/getters methods would reduce the possibility for instrumentation[1] to cause contention. Another option would be StampedLock[3] if the compile target is 1.8.

      [1] https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
      [2] https://github.com/dropwizard/metrics/blob/v3.2.2/metrics-httpclient/src/main/java/com/codahale/metrics/httpclient/InstrumentedHttpClientConnectionManager.java#L63-L95
      [3] https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/StampedLock.html

        Attachments

          Activity

            People

            • Assignee:
              olegk Oleg Kalnichevski
              Reporter:
              MattNelson Matt Nelson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: