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

Matthew Swift
19.07.2012 457fb799967565abbba9e813d35892b262791424
Fix OPENDJ-506: NoSuchElementException thrown during replication in java.util.TreeMap.key(TreeMap.java:1221)

Guard against concurrent removal of elements from lateQueue and reads.
1 files modified
9 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/MessageHandler.java 9 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -72,7 +72,9 @@
   */
  private final MsgQueue msgQueue = new MsgQueue();
  /**
   * Late queue.
   * Late queue. All access to the lateQueue in getNextMessage() is
   * single-threaded. However, reads from threads calling getOlderUpdateCN()
   * need protecting against removals performed using getNextMessage().
   */
  private final MsgQueue lateQueue = new MsgQueue();
  /**
@@ -405,7 +407,10 @@
        } else
        {
          /* get the next change from the lateQueue */
          msg = lateQueue.removeFirst();
          synchronized (msgQueue)
          {
            msg = lateQueue.removeFirst();
          }
          this.updateServerState(msg);
          return msg;
        }