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
29 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/types/LockManager.java 29 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/types/LockManager.java
@@ -217,12 +217,21 @@
          // and either return it or return null.
          readLock.unlock();
          readLock = existingLock.readLock();
          if (readLock.tryLock())
          try
          {
            return readLock;
            if (readLock.tryLock(0, TimeUnit.SECONDS))
            {
              return readLock;
            }
            else
            {
              return null;
            }
          }
          else
          catch(InterruptedException ie)
          {
            // This should never happen. Just return null
            return null;
          }
        }
@@ -421,12 +430,20 @@
          // and either return it or return null.
          writeLock.unlock();
          writeLock = existingLock.writeLock();
          if (writeLock.tryLock())
          try
          {
            return writeLock;
            if (writeLock.tryLock(0, TimeUnit.SECONDS))
            {
              return writeLock;
            }
            else
            {
              return null;
            }
          }
          else
          catch(InterruptedException ie)
          {
            // This should never happen. Just return null
            return null;
          }
        }