From 53ac6966e65a907785505fd1da1ac196730cd442 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 22 Nov 2013 08:24:47 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1174 Transfer responsibility for populating the ChangeNumberIndexDB to ChangelogDB

---
 opends/src/server/org/opends/server/replication/common/ServerState.java |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/ServerState.java b/opends/src/server/org/opends/server/replication/common/ServerState.java
index 1b20cb8..ae33dff 100644
--- a/opends/src/server/org/opends/server/replication/common/ServerState.java
+++ b/opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -140,9 +140,12 @@
   }
 
   /**
-   * Update the Server State with a CSN.
+   * Forward update the Server State with a CSN. The provided CSN will be put on
+   * the current object only if it is newer than the existing CSN for the same
+   * serverId or if there is no existing CSN.
    *
-   * @param csn The committed CSN.
+   * @param csn
+   *          The committed CSN.
    * @return a boolean indicating if the update was meaningful.
    */
   public boolean update(CSN csn)
@@ -154,9 +157,9 @@
 
     synchronized (serverIdToCSN)
     {
-      int serverId = csn.getServerId();
-      CSN oldCSN = serverIdToCSN.get(serverId);
-      if (oldCSN == null || csn.isNewerThan(oldCSN))
+      final int serverId = csn.getServerId();
+      final CSN existingCSN = serverIdToCSN.get(serverId);
+      if (existingCSN == null || csn.isNewerThan(existingCSN))
       {
         serverIdToCSN.put(serverId, csn);
         return true;

--
Gitblit v1.10.0