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

SimplePool.permitAcquired method swallows InterruptedException

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.9.1
    • Affects Version/s: 2.9.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      3.5.2-3.fc17.x86_64/JDK1.7.0_06 (x64)

      SimplePool.permitAcquired(long) method catches InterruptedException but fails to restore interrupted state of the thread thus effectively suppressing the effect of thread interruption.
      Here is the (abbreviated) code in question (SimplePool.java lines 146-159):

          private boolean permitAcquired(final long waitTime) {
              try {
                  // ......
              } catch (InterruptedException e) {
                  return false;
              }
          }
      

      Instead it should be:

          private boolean permitAcquired(final long waitTime) {
              try {
                  // ......
              } catch (InterruptedException e) {
                  Thread.currentThread().interrupt();
                  return false;
              }
          }
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            akrainiouk Alexei Krainiouk
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: