Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5140

Replace uninterruptible Lock.lock with Lock.lockInterruptibly

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 4.11.0
    • Affects Version/s: None
    • Component/s: Internal
    • Labels:
      None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      I searched the codebase for use of the Java SE concurrency primitives blocking methods that can't be interrupted (including blocking queues), and Lock.lock is the only method that may be worth replacing.

      We can analyze whether it is likely that a thread is blocked in Lock.lock by a noticeable duration, or, as we did with synchronized, we can mindlessly replace all the calls with Lock.lockInterruptibly and never use Lock.lock again. I prefer the mindless approach in these two cases.

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: