From bcf686add35bda4a6ac5c3d085abe151ea018e8e Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 14 Jan 2009 08:29:50 +0000
Subject: [PATCH] 

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index c6629eb..a0e0d85 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -49,6 +49,7 @@
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -869,7 +870,18 @@
         }
         else
         {
-          pendingChanges.commit(curChangeNumber, msg);
+          // If assured replication is configured, this will prepare blocking
+          // mechanism. If assured replication is disabled, this returns
+          // immediately
+          prepareWaitForAckIfAssuredEnabled(msg);
+          try
+          {
+            msg.encode();
+          } catch (UnsupportedEncodingException e)
+          {
+            // will be caught at publish time.
+          }
+          pendingChanges.commitAndPushCommittedChanges(curChangeNumber, msg);
         }
       }
       catch  (NoSuchElementException e)
@@ -892,18 +904,12 @@
       if (curChangeNumber != null)
       {
         pendingChanges.remove(curChangeNumber);
+        pendingChanges.pushCommittedChanges();
       }
     }
 
     if (!op.isSynchronizationOperation())
     {
-      // If assured replication is configured, this will prepare blocking
-      // mechanism. If assured replication is disabled, this returns
-      // immediately
-      prepareWaitForAckIfAssuredEnabled(msg);
-
-      pendingChanges.pushCommittedChanges();
-
       // If assured replication is enabled, this will wait for the matching
       // ack or time out. If assured replication is disabled, this returns
       // immediately

--
Gitblit v1.10.0