From 6727fbc1a159686d355716af0f6d6815bf4054f0 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 29 May 2007 08:54:18 +0000
Subject: [PATCH] 

---
 opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
index 7d2566a..985d2f0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -137,6 +137,9 @@
   private AtomicInteger numRcvdUpdates = new AtomicInteger(0);
   private AtomicInteger numSentUpdates = new AtomicInteger(0);
   private AtomicInteger numProcessedUpdates = new AtomicInteger();
+  private AtomicInteger numResolvedNamingConflicts = new AtomicInteger();
+  private AtomicInteger numResolvedModifyConflicts = new AtomicInteger();
+  private AtomicInteger numUnresolvedNamingConflicts = new AtomicInteger();
   private int debugCount = 0;
   private PersistentServerState state;
   private int numReplayedPostOpCalled = 0;
@@ -618,7 +621,10 @@
       Historical historicalInformation = Historical.load(modifiedEntry);
       modifyOperation.setAttachment(HISTORICAL, historicalInformation);
 
-      historicalInformation.replayOperation(modifyOperation, modifiedEntry);
+      if (historicalInformation.replayOperation(modifyOperation, modifiedEntry))
+      {
+        numResolvedModifyConflicts.incrementAndGet();
+      }
 
       if (modifyOperation.getModifications().isEmpty())
       {
@@ -1150,9 +1156,14 @@
         String message = getMessage(msgID, op.toString());
         logError(ErrorLogCategory.SYNCHRONIZATION,
             ErrorLogSeverity.SEVERE_ERROR, message, msgID);
+        numUnresolvedNamingConflicts.incrementAndGet();
 
         updateError(changeNumber);
       }
+      else
+      {
+        numResolvedNamingConflicts.incrementAndGet();
+      }
     }
     catch (ASN1Exception e)
     {
@@ -1557,6 +1568,7 @@
       ModifyDNMsg modifyDnMsg = (ModifyDNMsg) msg;
       msg.setDn(currentDN.toString());
       modifyDnMsg.setNewSuperior(newSuperior.toString());
+      numUnresolvedNamingConflicts.incrementAndGet();
       return false;
     }
     else if (result == ResultCode.ENTRY_ALREADY_EXISTS)
@@ -1572,6 +1584,7 @@
       modifyDnMsg.setNewRDN(generateConflictDn(entryUid,
                             modifyDnMsg.getNewRDN()));
       modifyDnMsg.setNewSuperior(newSuperior.toString());
+      numUnresolvedNamingConflicts.incrementAndGet();
       return false;
     }
     return true;
@@ -1677,6 +1690,33 @@
   }
 
   /**
+   * Get the number of modify conflicts successfully resolved.
+   * @return The number of modify conflicts successfully resolved.
+   */
+  public int getNumResolvedModifyConflicts()
+  {
+    return numResolvedModifyConflicts.get();
+  }
+
+  /**
+   * Get the number of namign conflicts successfully resolved.
+   * @return The number of naming conflicts successfully resolved.
+   */
+  public int getNumResolvedNamingConflicts()
+  {
+    return numResolvedNamingConflicts.get();
+  }
+
+  /**
+   * Get the number of unresolved conflicts.
+   * @return The number of unresolved conflicts.
+   */
+  public int getNumUnresolvedNamingConflicts()
+  {
+    return numUnresolvedNamingConflicts.get();
+  }
+
+  /**
    * Check if the domain solve conflicts.
    *
    * @return a boolean indicating if the domain should sove conflicts.

--
Gitblit v1.10.0