From 8170a25a086fb89f90a2b2b8613e7b7d82a47208 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 08 Aug 2013 13:37:11 +0000
Subject: [PATCH] Big refactoring of ReplicationDB to make it readable. Changed count() return type from int to long. Removed a useless parameter from ReplicationIterator ctor. Various code cleanups in other classes.

---
 opends/src/server/org/opends/server/replication/server/ReplicationIterator.java |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationIterator.java b/opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
index 29c086b..4e7a898 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
@@ -43,27 +43,25 @@
   private ReplServerDBCursor cursor = null;
   private DbHandler dbh;
   private ReplicationDB db;
-  ChangeNumber lastNonNullCurrentCN;
+  private ChangeNumber lastNonNullCurrentCN;
 
   /**
    * Creates a new ReplicationIterator.
    * All created iterator must be released by the caller using the
    * releaseCursor() method.
    *
-   * @param id the Identifier of the server on which the iterator applies.
    * @param db The db where the iterator must be created.
    * @param changeNumber The ChangeNumber after which the iterator must start.
-   * @param dbh The associated DbHandler.
+   * @param dbHandler The associated DbHandler.
    * @throws Exception If there is no other change to push after change
    *         with changeNumber number.
    * @throws DatabaseException if a database problem happened.
    */
-  public ReplicationIterator(
-          int id, ReplicationDB db, ChangeNumber changeNumber, DbHandler dbh)
-          throws Exception, DatabaseException
+  public ReplicationIterator(ReplicationDB db, ChangeNumber changeNumber,
+      DbHandler dbHandler) throws Exception, DatabaseException
   {
     this.db = db;
-    this.dbh = dbh;
+    this.dbh = dbHandler;
     this.lastNonNullCurrentCN = changeNumber;
 
     try
@@ -79,7 +77,7 @@
     if (cursor == null)
     {
       // flush the queue into the db
-      dbh.flush();
+      dbHandler.flush();
 
       // look again in the db
       cursor = db.openReadCursor(changeNumber);
@@ -173,6 +171,7 @@
    * Release the cursor in case the iterator was badly used and releaseCursor
    * was never called.
    */
+  @Override
   protected void finalize()
   {
     releaseCursor();

--
Gitblit v1.10.0