From 6fe1a8d104a5af85d8a358798eadb3dd24aa6915 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 28 Jun 2013 09:46:28 +0000
Subject: [PATCH] PendingChanges.java: Removed methods starting with '_', and replaced them with their counterparts not starting with '_'. Small code cleanup for the rest.

---
 opends/src/server/org/opends/server/replication/plugin/PendingChanges.java |   66 +++++++--------------------------
 1 files changed, 14 insertions(+), 52 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java b/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
index 45893d8..c7cf14e 100644
--- a/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
+++ b/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
@@ -23,19 +23,18 @@
  *
  *
  *      Copyright 2009 Sun Microsystems, Inc.
- *      Portions Copyright 2011 ForgeRock AS
+ *      Portions Copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.replication.plugin;
 
-
 import java.util.NoSuchElementException;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import org.opends.server.replication.service.ReplicationDomain;
 import org.opends.server.replication.common.ChangeNumber;
 import org.opends.server.replication.common.ChangeNumberGenerator;
 import org.opends.server.replication.protocol.LDAPUpdateMsg;
+import org.opends.server.replication.service.ReplicationDomain;
 import org.opends.server.types.operation.PluginOperation;
 
 /**
@@ -67,6 +66,8 @@
    */
   private ReplicationDomain domain;
 
+  private boolean recoveringOldChanges = false;
+
   /**
    * Creates a new PendingChanges using the provided ChangeNumberGenerator.
    *
@@ -114,25 +115,12 @@
   public synchronized void commit(ChangeNumber changeNumber,
       LDAPUpdateMsg msg)
   {
-    _commit(changeNumber, msg);
-  }
-  /**
-   * Mark an update message as committed.
-   *
-   * @param changeNumber The ChangeNumber of the update message that must be
-   *                     set as committed.
-   * @param msg          The message associated to the update.
-   */
-  public void _commit(ChangeNumber changeNumber,
-      LDAPUpdateMsg msg)
-  {
     PendingChange curChange = pendingChanges.get(changeNumber);
     if (curChange == null)
     {
       throw new NoSuchElementException();
     }
     curChange.setCommitted(true);
-
     curChange.setMsg(msg);
   }
 
@@ -162,25 +150,10 @@
    */
   public synchronized ChangeNumber putLocalOperation(PluginOperation operation)
   {
-    return _putLocalOperation(operation);
-  }
-  /**
-   * Add a new UpdateMsg to the pending list from the provided local
-   * operation.
-   *
-   * @param operation The local operation for which an UpdateMsg must
-   *                  be added in the pending list.
-   * @return The ChangeNumber now associated to the operation.
-   */
-  public  ChangeNumber _putLocalOperation(PluginOperation operation)
-  {
-    ChangeNumber changeNumber;
-
-    changeNumber = changeNumberGenerator.newChangeNumber();
+    ChangeNumber changeNumber = changeNumberGenerator.newChangeNumber();
     PendingChange change = new PendingChange(changeNumber, operation, null);
     pendingChanges.put(changeNumber, change);
     return changeNumber;
-
   }
 
   /**
@@ -190,26 +163,19 @@
    */
   public synchronized int pushCommittedChanges()
   {
-    return _pushCommittedChanges();
-  }
-  /**
-   * Push all committed local changes to the replicationServer service.
-   *
-   * @return The number of pushed updates.
-   */
-  public int _pushCommittedChanges()
-  {
     int numSentUpdates = 0;
     if (pendingChanges.isEmpty())
+    {
       return numSentUpdates;
+    }
 
     ChangeNumber firstChangeNumber = pendingChanges.firstKey();
     PendingChange firstChange = pendingChanges.get(firstChangeNumber);
 
-    while ((firstChange != null) && firstChange.isCommitted())
+    while (firstChange != null && firstChange.isCommitted())
     {
-      if ((firstChange.getOp() != null ) &&
-          (firstChange.getOp().isSynchronizationOperation() == false))
+      if (firstChange.getOp() != null
+          && !firstChange.getOp().isSynchronizationOperation())
       {
         numSentUpdates++;
         LDAPUpdateMsg updateMsg = firstChange.getMsg();
@@ -250,14 +216,12 @@
    * @return The number of pushed updates.
    */
   public synchronized int commitAndPushCommittedChanges(
-      ChangeNumber changeNumber,
-      LDAPUpdateMsg msg)
+      ChangeNumber changeNumber, LDAPUpdateMsg msg)
   {
-    _commit(changeNumber, msg);
-    return _pushCommittedChanges();
+    commit(changeNumber, msg);
+    return pushCommittedChanges();
   }
 
-  private boolean recoveringOldChanges = false;
   /**
    * Set the PendingChangesList structure in a mode where it is
    * waiting for the RS to receive all the previous changes to
@@ -288,12 +252,10 @@
    * @return           A boolean indicating if the recovery is completed (false)
    *                   or must continue (true).
    */
-
   public synchronized boolean recoveryUntil(ChangeNumber recovered)
   {
     ChangeNumber lastLocalChange = domain.getLastLocalChange();
-
-    if ((recovered != null) && (recovered.newerOrEquals(lastLocalChange)))
+    if (recovered != null && recovered.newerOrEquals(lastLocalChange))
     {
       recoveringOldChanges = false;
     }

--
Gitblit v1.10.0