mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

boli
24.06.2007 fbabc64c7ccff868c280c28d4de74f06db175437
Fix a issue where adding entries below a parent entry and modifying the parent entry causes lock expirations. All writer threads for the modify 
operations were being starved by the reader threads for the add operations. Changed the LockManager to observe fairness rules when granting
locks so waiting write locks are granted before read locks.

Fix for issue 1896
1 files modified
21 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/types/LockManager.java 21 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/types/LockManager.java
@@ -217,7 +217,10 @@
          // and either return it or return null.
          readLock.unlock();
          readLock = existingLock.readLock();
          if (readLock.tryLock())
          try
          {
            if (readLock.tryLock(0, TimeUnit.SECONDS))
          {
            return readLock;
          }
@@ -226,6 +229,12 @@
            return null;
          }
        }
          catch(InterruptedException ie)
          {
            // This should never happen. Just return null
            return null;
          }
        }
        else
        {
          // If this happens, then it means that while we were waiting
@@ -421,7 +430,9 @@
          // and either return it or return null.
          writeLock.unlock();
          writeLock = existingLock.writeLock();
          if (writeLock.tryLock())
          try
          {
            if (writeLock.tryLock(0, TimeUnit.SECONDS))
          {
            return writeLock;
          }
@@ -430,6 +441,12 @@
            return null;
          }
        }
          catch(InterruptedException ie)
          {
            // This should never happen. Just return null
            return null;
          }
        }
        else
        {
          // If this happens, then it means that while we were waiting