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

Jean-Noel Rouvignac
02.51.2014 819f74758a1c464bbf578e70ca8592cc8d101d75
opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDBCursor.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.opends.server.replication.server.changelog.je;
@@ -73,15 +73,6 @@
      // we didn't find it in the db
      cursor = null;
    }
    if (cursor == null)
    {
      // flush the queue into the db
      replicaDB.flush();
      // look again in the db
      cursor = db.openReadCursor(startAfterCSN);
    }
  }
  /** {@inheritDoc} */
@@ -96,15 +87,7 @@
  public boolean next() throws ChangelogException
  {
    final ReplServerDBCursor localCursor = cursor;
    if (localCursor != null)
    {
      currentChange = localCursor.next();
    }
    else
    {
      currentChange = null;
    }
    currentChange = localCursor != null ? localCursor.next() : null;
    if (currentChange != null)
    {
@@ -114,12 +97,8 @@
    {
      synchronized (this)
      {
        if (cursor != null)
        {
          cursor.close();
          cursor = null;
        }
        replicaDB.flush();
        closeCursor();
        // previously exhausted cursor must be able to reinitialize themselves
        cursor = db.openReadCursor(lastNonNullCurrentCSN);
        currentChange = cursor.next();
        if (currentChange != null)
@@ -137,13 +116,17 @@
  {
    synchronized (this)
    {
      if (cursor != null)
      {
        cursor.close();
        cursor = null;
      }
      closeCursor();
      this.replicaDB = null;
      this.db = null;
    }
  }
  private void closeCursor()
  {
    if (cursor != null)
    {
      cursor.close();
      cursor = null;
    }
  }