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

Jean-Noel Rouvignac
04.03.2013 e3add78e22e130ef6ece000a7989f4f4317d4da8
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
File was renamed from opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDbHandler.java
@@ -64,7 +64,7 @@
 * This class publishes some monitoring information below <code>
 * cn=monitor</code>.
 */
public class DraftCNDbHandler implements ChangeNumberIndexDB, Runnable
public class JEChangeNumberIndexDB implements ChangeNumberIndexDB, Runnable
{
  /**
   * The tracer object for the debug logger.
@@ -108,14 +108,14 @@
  /**
   * Creates a new dbHandler associated to a given LDAP server.
   * Creates a new JEChangeNumberIndexDB associated to a given LDAP server.
   *
   * @param replicationServer The ReplicationServer that creates this dbHandler.
   * @param replicationServer The ReplicationServer that creates this instance.
   * @param dbenv the Database Env to use to create the ReplicationServer DB.
   * server for this domain.
   * @throws ChangelogException If a database problem happened
   */
  public DraftCNDbHandler(ReplicationServer replicationServer,
  public JEChangeNumberIndexDB(ReplicationServer replicationServer,
      ReplicationDbEnv dbenv) throws ChangelogException
  {
    this.replicationServer = replicationServer;
@@ -133,7 +133,8 @@
        new AtomicLong((lastRecord != null) ? lastRecord.getChangeNumber() : 0);
    // Trimming thread
    thread = new DirectoryThread(this, "Replication DraftCN db");
    thread =
        new DirectoryThread(this, "Replication ChangeNumberIndexDB Trimmer");
    thread.start();
    // Monitoring registration
@@ -157,7 +158,7 @@
    db.addRecord(record);
    if (debugEnabled())
      TRACER.debugInfo("In DraftCNDbhandler.add, added: " + record);
      TRACER.debugInfo("In JEChangeNumberIndexDB.add, added: " + record);
  }
  /** {@inheritDoc} */
@@ -227,7 +228,7 @@
  public ChangeNumberIndexDBCursor getCursorFrom(long startChangeNumber)
      throws ChangelogException
  {
    return new DraftCNDbIterator(db, startChangeNumber);
    return new JEChangeNumberIndexDBCursor(db, startChangeNumber);
  }
  /** {@inheritDoc} */
@@ -332,14 +333,13 @@
      {
        for (int j = 0; j < 50; j++)
        {
          // let's traverse the DraftCNDb
          // let's traverse the CNIndexDB
          if (!cursor.next())
          {
            cursor.close();
            return;
          }
          // From the draftCNDb change record, get the domain and CSN
          final CNIndexRecord record = cursor.currentRecord();
          if (baseDNToClear != null && baseDNToClear.equals(record.getBaseDN()))
          {
@@ -352,8 +352,7 @@
          if (domain == null)
          {
            // the domain has been removed since the record was written in the
            // draftCNDb, thus it makes no sense to keep the record in the
            // draftCNDb.
            // CNIndexDB, thus it makes no sense to keep this record in the DB.
            cursor.delete();
            continue;
          }
@@ -379,12 +378,12 @@
            csnVector = csnStartStates.get(record.getBaseDN());
            if (debugEnabled())
              TRACER.debugInfo("DraftCNDBHandler:clear() - ChangeVector:"
              TRACER.debugInfo("JEChangeNumberIndexDB:clear() - ChangeVector:"
                  + csnVector + " -- StartState:" + startState);
          }
          catch(Exception e)
          {
            // We couldn't parse the mdss from the DraftCNData Value
            // We could not parse the MultiDomainServerState from the record
            cursor.delete();
            continue;
          }
@@ -395,7 +394,7 @@
          {
            cursor.delete();
            if (debugEnabled())
              TRACER.debugInfo("DraftCNDBHandler:clear() - deleted " + csn
              TRACER.debugInfo("JEChangeNumberIndexDB:clear() - deleted " + csn
                  + "Not covering startState");
            continue;
          }
@@ -427,8 +426,8 @@
  }
  /**
   * This internal class is used to implement the Monitoring capabilities
   * of the dbHandler.
   * This internal class is used to implement the Monitoring capabilities of the
   * JEChangeNumberIndexDB.
   */
  private class DbMonitorProvider extends MonitorProvider<MonitorProviderCfg>
  {
@@ -498,7 +497,8 @@
  @Override
  public String toString()
  {
    return "draftCNdb:" + " " + firstChangeNumber + " " + lastChangeNumber;
    return "JEChangeNumberIndexDB: " + firstChangeNumber + " "
        + lastChangeNumber;
  }
  /**