/** Start collecting global monitoring information for the replication domain. */
  private void initializePendingMonitorData() {
    // Let's process our directly connected DS
    // - in the ServerHandler for a given DS1, the stored state contains :
    // -- the max CSN produced by DS1
    // -- the last CSN consumed by DS1 from DS2..n
    // - in the ReplicationDomainDB/ReplicaDB, the built-in state contains:
    // -- the max CSN produced by each server
    // So for a given DS connected we can take the state and the max from
    // the DS/state.

    for (ServerHandler ds : domain.getConnectedDSs().values()) {
      final int serverId = ds.getServerId();
      final ServerState dsState = ds.getServerState().duplicate();

      CSN maxCSN = dsState.getCSN(serverId);
      if (maxCSN == null) {
        // This directly connected LS has never produced any change
        maxCSN = new CSN(0, 0, serverId);
      }
      pendingMonitorData.setMaxCSN(maxCSN);
      pendingMonitorData.setLDAPServerState(serverId, dsState);
      pendingMonitorData.setFirstMissingDate(serverId, ds.getApproxFirstMissingDate());
    }

    // Then initialize the max CSN for the LS that produced something
    // - from our own local db state
    // - whatever they are directly or indirectly connected
    final ServerState dbServerState = domain.getLatestServerState();
    pendingMonitorData.setRSState(domain.getLocalRSServerId(), dbServerState);
    for (CSN storedCSN : dbServerState) {
      pendingMonitorData.setMaxCSN(storedCSN);
    }
  }