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

Jean-Noel Rouvignac
08.52.2013 d454b5f9a2b7dc4ef2a70cd983a26436568cbe04
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
@@ -79,8 +79,7 @@
 * <p>
 * Currently are only implemented the create and restore backup features.
 */
public class ReplicationBackend
       extends Backend
public class ReplicationBackend extends Backend
{
  private static final String CHANGE_NUMBER = "replicationChangeNumber";
@@ -620,43 +619,41 @@
   * Exports or returns all the changes from a ReplicationServerDomain coming
   * after the CSN specified in the searchOperation.
   */
  private void writeChangesAfterCSN(ReplicationServerDomain rsd,
  private void writeChangesAfterCSN(ReplicationServerDomain rsDomain,
      final LDIFExportConfig exportConfig, LDIFWriter ldifWriter,
      SearchOperation searchOperation, final CSN previousCSN)
  {
    for (int serverId : rsd.getServerIds())
    if (exportConfig != null && exportConfig.isCancelled())
    { // Abort if cancelled
      return;
    }
    ReplicaDBCursor cursor = rsDomain.getCursorFrom(previousCSN);
    try
    {
      if (exportConfig != null && exportConfig.isCancelled())
      { // Abort if cancelled
        return;
      }
      int lookthroughCount = 0;
      ReplicaDBCursor cursor = rsd.getCursorFrom(serverId, previousCSN);
      try
      // Walk through the changes
      cursor.next(); // first try to advance the cursor
      while (cursor.getChange() != null)
      {
        int lookthroughCount = 0;
        // Walk through the changes
        while (cursor.getChange() != null)
        {
          if (exportConfig != null && exportConfig.isCancelled())
          { // abort if cancelled
            return;
          }
          if (!canContinue(searchOperation, lookthroughCount))
          {
            break;
          }
          lookthroughCount++;
          writeChange(cursor.getChange(), ldifWriter, searchOperation,
              rsd.getBaseDN(), exportConfig != null);
          cursor.next();
        if (exportConfig != null && exportConfig.isCancelled())
        { // abort if cancelled
          return;
        }
        if (!canContinue(searchOperation, lookthroughCount))
        {
          break;
        }
        lookthroughCount++;
        writeChange(cursor.getChange(), ldifWriter, searchOperation,
            rsDomain.getBaseDN(), exportConfig != null);
        cursor.next();
      }
      finally
      {
        close(cursor);
      }
    }
    finally
    {
      close(cursor);
    }
  }