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

Ludovic Poitou
30.20.2011 bfef6b181cc5271d8f706c576f2bcd29d3345bf9
opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -518,4 +518,31 @@
  {
    return saved;
  }
  /**
   * Build a copy of the ServerState with only ChangeNumbers older than
   * a specific ChangeNumber. This is used when building the initial
   * Cookie in the External Changelog, to cope with purged changes.
   * @param cn The ChangeNumber to compare the ServerState with
   * @return a copy of the ServerState which only contains the ChangeNumbers
   *         older than cn.
   */
  public ServerState duplicateOnlyOlderThan(ChangeNumber cn)
  {
    ServerState newState = new ServerState();
    synchronized (list)
    {
      for (Integer key  : list.keySet())
      {
        ChangeNumber change = list.get(key);
        Integer id =  change.getServerId();
        if (change.older(cn))
        {
          newState.list.put(id,change);
        }
      }
    }
    return newState;
  }
}