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

Valery Kharseko
23 hours ago b8a4d35f03b7fa5cf0d80a9424224f6ddeb3b3f9
opendj-server-legacy/src/main/java/org/opends/server/replication/server/MsgQueue.java
@@ -20,6 +20,7 @@
import static org.opends.messages.ReplicationMessages.*;
import java.util.TreeMap;
import java.util.function.Predicate;
import net.jcip.annotations.ThreadSafe;
@@ -178,6 +179,32 @@
    }
  }
  /**
   * Returns whether this queue holds, before the given UpdateMsg, an UpdateMsg which carries the
   * CSN of a change and matches the given condition: a replica offline message, for one, does not
   * carry the CSN of a change, and no state ever covers its CSN.
   *
   * @param msg
   *          the UpdateMsg the ones to check come before
   * @param condition
   *          the condition the CSN of a change must match
   * @return {@code true} if a change of this queue before the given UpdateMsg matches the condition
   */
  public boolean holdsAChangeBefore(UpdateMsg msg, Predicate<CSN> condition)
  {
    synchronized (lock)
    {
      for (UpdateMsg before : map.headMap(msg.getCSN()).values())
      {
        if (before.contributesToDomainState() && condition.test(before.getCSN()))
        {
          return true;
        }
      }
      return false;
    }
  }
  /** Removes all UpdateMsg form this queue. */
  public void clear()
  {