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

Jean-Noel Rouvignac
18.44.2014 90058723ac5ab9860d1287e6051896a16aea7fa5
Fixed CompositeDBCursorTest.recycleTwoElementsCursor() test.
1 files modified
25 ■■■■■ changed files
opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java 25 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/je/CompositeDBCursor.java
@@ -93,24 +93,19 @@
      return false;
    }
    if (state == UNINITIALIZED)
    // If previous state was ready, then we must advance the first cursor
    // (which UpdateMsg has been consumed).
    // To keep consistent the cursors' order in the SortedSet, it is necessary
    // to remove the first cursor, then add it again after moving it forward.
    final Entry<DBCursor<UpdateMsg>, Data> cursorToAdvance =
        state != UNINITIALIZED ? cursors.pollFirstEntry() : null;
    state = READY;
    recycleExhaustedCursors();
    if (cursorToAdvance != null)
    {
      state = READY;
    }
    else
    {
      // Previous state was READY => we must advance the first cursor
      // because the UpdateMsg it is pointing has already been consumed.
      // To keep consistent the cursors' order in the SortedSet, it is necessary
      // to remove the first cursor, then add it again after moving it forward.
      final Entry<DBCursor<UpdateMsg>, Data> cursorToAdvance = cursors.pollFirstEntry();
      if (cursorToAdvance != null)
      {
        addCursor(cursorToAdvance.getKey(), cursorToAdvance.getValue());
      }
      addCursor(cursorToAdvance.getKey(), cursorToAdvance.getValue());
    }
    recycleExhaustedCursors();
    removeNoLongerNeededCursors();
    incorporateNewCursors();
    return !cursors.isEmpty();