From 0667279a02d2cc651ebcac518e50b773a4aa9412 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.

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

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
index dc33cc8..3758a13 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
@@ -315,25 +315,26 @@
           serverId + " " + baseDn + " " + generationId);
       try
       {
-        String key = serverId + FIELD_SEPARATOR + baseDn;
+        final String serverIdKey = serverId + FIELD_SEPARATOR + baseDn;
 
         // Opens the database for the changes received from this server
         // on this domain. Create it if it does not already exist.
         DatabaseConfig dbConfig = new DatabaseConfig();
         dbConfig.setAllowCreate(true);
         dbConfig.setTransactional(true);
-        Database db = dbEnvironment.openDatabase(null, key, dbConfig);
+        Database db = dbEnvironment.openDatabase(null, serverIdKey, dbConfig);
 
         // Creates the record serverId/domain base Dn in the stateDb
         // if it does not already exist.
-        putInStateDBIfNotExist(key, key);
+        putInStateDBIfNotExist(serverIdKey, serverIdKey);
 
         // Creates the record domain base Dn/ generationId in the stateDb
         // if it does not already exist.
-        key = GENERATION_ID_TAG + FIELD_SEPARATOR + baseDn;
-        String data = GENERATION_ID_TAG + FIELD_SEPARATOR + generationId
-                + FIELD_SEPARATOR + baseDn;
-        putInStateDBIfNotExist(key, data);
+        final String genIdKey = GENERATION_ID_TAG + FIELD_SEPARATOR + baseDn;
+        final String genIdData = GENERATION_ID_TAG
+            + FIELD_SEPARATOR + generationId
+            + FIELD_SEPARATOR + baseDn;
+        putInStateDBIfNotExist(genIdKey, genIdData);
         return db;
       }
       catch (UnsupportedEncodingException e)

--
Gitblit v1.10.0