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

pgamba
02.58.2007 b48ce50fdf4d73e8be3799e3a7c6c2bf9d1b2965
opends/src/server/org/opends/server/replication/server/ServerWriter.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.opends.messages.ReplicationMessages.*;
import java.io.IOException;
@@ -97,12 +98,35 @@
        TRACER.debugInfo("LDAP server writer starting " + serverId);
      }
    }
    try {
    try
    {
      while (true)
      {
        UpdateMessage update = replicationCache.take(this.handler);
        if (update == null)
          return;       /* this connection is closing */
        // Ignore update to be sent to a replica with a bad generation ID
        long referenceGenerationId = replicationCache.getGenerationId();
        if (referenceGenerationId != handler.getGenerationId())
        {
          logError(ERR_IGNORING_UPDATE_TO.get(
              update.getDn(),
              this.handler.getMonitorInstanceName()));
          continue;
        }
        if (debugEnabled())
        {
          TRACER.debugInfo(
            "In " + replicationCache.getReplicationServer().
              getMonitorInstanceName() +
            ", writer to " + this.handler.getMonitorInstanceName() +
            " publishes" + update.toString() +
            " refgenId=" + referenceGenerationId +
            " server=" + handler.getServerId() +
            " generationId=" + handler.getGenerationId());
        }
        session.publish(update);
      }
    }
@@ -130,7 +154,8 @@
       * An unexpected error happened.
       * Log an error and close the connection.
       */
      Message message = ERR_WRITER_UNEXPECTED_EXCEPTION.get(handler.toString());
      Message message = ERR_WRITER_UNEXPECTED_EXCEPTION.get(handler.toString() +
                        " " +  stackTraceToSingleLineString(e));
      logError(message);
    }
    finally {