From 62c7d9970ee34d102a78ce72a459274a97721cc6 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Jun 2014 14:50:38 +0000
Subject: [PATCH] OPENDJ-1453 (CR-3697) Change time heart beat change numbers should be synced with updates

---
 opendj3-server-dev/src/server/org/opends/server/replication/plugin/PendingChange.java |   58 +++++++++++++++++++++-------------------------------------
 1 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/PendingChange.java b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/PendingChange.java
index b9f8203..e694ab4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/PendingChange.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/PendingChange.java
@@ -22,28 +22,26 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
- *      Portions copyright 2013 ForgeRock AS
+ *      Portions copyright 2014 ForgeRock AS
  */
 package org.opends.server.replication.plugin;
 
 import org.opends.server.replication.common.CSN;
 import org.opends.server.replication.common.ServerState;
 import org.opends.server.replication.protocol.LDAPUpdateMsg;
-import org.opends.server.types.DN;
 import org.opends.server.types.operation.PluginOperation;
 
 /**
  * This class is use to store an operation currently
  * in progress and not yet committed in the database.
  */
-public class PendingChange implements Comparable<PendingChange>
+class PendingChange implements Comparable<PendingChange>
 {
-  private CSN csn;
+  private final CSN csn;
   private boolean committed;
   private LDAPUpdateMsg msg;
-  private PluginOperation op;
+  private final PluginOperation op;
   private ServerState dependencyState;
-  private DN targetDN;
 
   /**
    * Construct a new PendingChange.
@@ -51,7 +49,7 @@
    * @param op the operation to use
    * @param msg the message to use (can be null for local operations)
    */
-  public PendingChange(CSN csn, PluginOperation op, LDAPUpdateMsg msg)
+  PendingChange(CSN csn, PluginOperation op, LDAPUpdateMsg msg)
   {
     this.csn = csn;
     this.committed = false;
@@ -115,15 +113,6 @@
   }
 
   /**
-   * Set the operation associated to this PendingChange.
-   * @param op The operation associated to this PendingChange.
-   */
-  public void setOp(PluginOperation op)
-  {
-    this.op = op;
-  }
-
-  /**
    * Add the given CSN to the list of dependencies of this PendingChange.
    *
    * @param csn
@@ -152,29 +141,24 @@
     return state.cover(dependencyState);
   }
 
-  /**
-   * Get the Target DN of this message.
-   *
-   * @return The target DN of this message.
-   */
-  public DN getTargetDN()
-  {
-    synchronized (this)
-    {
-      if (targetDN == null)
-      {
-        targetDN = msg.getDN();
-      }
-      return targetDN;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public int compareTo(PendingChange o)
   {
-    return getCSN().compareTo(o.getCSN());
+    return csn.compareTo(o.csn);
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public String toString()
+  {
+    return getClass().getSimpleName()
+        + " committed=" + committed
+        + ", csn=" + csn.toStringUI()
+        + ", msg=[" + msg
+        + "], isOperationSynchronized="
+        + (op != null ? op.isSynchronizationOperation() : "false")
+        + ", dependencyState="
+        + (dependencyState != null ? dependencyState : "");
   }
 }

--
Gitblit v1.10.0