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

Jean-Noel Rouvignac
05.12.2015 cad9f27d3ba6753e2bf3176c3c71b0e07e73f1b8
opendj3-server-dev/src/server/org/opends/server/replication/plugin/EntryHistorical.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.replication.plugin;
import static org.opends.messages.ReplicationMessages.*;
import java.util.*;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -40,9 +42,6 @@
import org.opends.server.types.operation.PreOperationModifyOperation;
import org.opends.server.util.TimeThread;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.*;
/**
 * This class is used to store historical information that is
 * used to resolve modify conflicts
@@ -97,13 +96,13 @@
   * an entry that has no historical attribute and after the last
   * historical has been purged.
   */
  private CSN oldestCSN = null;
  private CSN oldestCSN;
  /**
   * For stats/monitoring purpose, the number of historical values
   * purged the last time a purge has been applied on this entry historical.
   */
  private int lastPurgedValuesCount = 0;
  private int lastPurgedValuesCount;
  /**
@@ -146,10 +145,10 @@
   */
  /** The date when the entry was added. */
  private CSN entryADDDate = null;
  private CSN entryADDDate;
  /** The date when the entry was last renamed. */
  private CSN entryMODDNDate = null;
  private CSN entryMODDNDate;
  /**
   * Contains Historical information for each attribute sorted by attribute
@@ -158,9 +157,7 @@
  private HashMap<AttributeType,AttrHistoricalWithOptions> attributesHistorical
    = new HashMap<AttributeType,AttrHistoricalWithOptions>();
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public String toString()
  {
@@ -244,7 +241,9 @@
        // (eventually read from the provided modification)
        AttrHistorical attrHist = getOrCreateAttrHistorical(mod);
        if (attrHist != null)
        {
          attrHist.processLocalOrNonConflictModification(csn, mod);
        }
      }
    }
@@ -423,7 +422,9 @@
    // the potentially set purge delay.
    this.lastPurgedValuesCount = 0;
    if (purgeDelayInMillisec>0)
    {
      purgeDate = TimeThread.getTime() - purgeDelayInMillisec;
    }
    AttributeType historicalAttrType =
      DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
@@ -597,15 +598,22 @@
  public CSN getDNDate()
  {
    if (entryADDDate == null)
    {
      return entryMODDNDate;
    }
    if (entryMODDNDate == null)
    {
      return entryADDDate;
    }
    if (entryMODDNDate.isOlderThan(entryADDDate))
    {
      return entryMODDNDate;
    }
    else
    {
      return entryADDDate;
    }
  }
  /**
@@ -859,8 +867,7 @@
  public static boolean isHistoricalAttribute(Attribute attr)
  {
    AttributeType attrType = attr.getAttributeType();
    return
      attrType.getNameOrOID().equals(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
    return EntryHistorical.HISTORICAL_ATTRIBUTE_NAME.equals(attrType.getNameOrOID());
  }
  /**
@@ -873,7 +880,9 @@
  {
    if (csn != null
        && (this.oldestCSN == null || csn.isOlderThan(this.oldestCSN)))
    {
      this.oldestCSN = csn;
    }
  }
  /**