Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6625724

Allow ReentrantReadWriteLock to not track per-thread read holds

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      As of jdk6, per-thread read holds are tracked by ReentrantReadWriteLock.
      While very useful for catching coding errors where read lock unlock actions
      are not matched by a lock action in the same thread, the cost of
      maintaining such counts was surprisingly high in runtime space and/or time.
      See:
      6625723 Excessive ThreadLocal storage used by ReentrantReadWriteLock
      for our best attempt to mitigate this cost.

      For most users, the extra safety of tracking read holds is not worth the
      extra overhead. The maintainers of ReentrantReadWriteLock now regret
      having added this extra overhead. Unfortunately, we cannot withdraw support
      for this, since we added the public getReadHoldCount method.

      But we can add a constructor that explicitly disclaims support for tracking
      read hold counts.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                martin Martin Buchholz
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: