From 2285a5db2a9f643686b6d4f27fcf557055771437 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Thu, 05 Mar 2009 14:41:17 +0000
Subject: [PATCH] Fix for 3844 : ReplicationDomain.publish can loose changes when called by several thread.

---
 opends/src/server/org/opends/server/replication/service/ReplicationDomain.java |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
index f4a8727..9e829c2 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -2618,14 +2618,18 @@
    */
   public void publish(byte[] msg)
   {
-    UpdateMsg update = new UpdateMsg(generator.newChangeNumber(), msg);
+    UpdateMsg update;
+    synchronized (this)
+    {
+      update = new UpdateMsg(generator.newChangeNumber(), msg);
 
-    // If assured replication is configured, this will prepare blocking
-    // mechanism. If assured replication is disabled, this returns
-    // immediately
-    prepareWaitForAckIfAssuredEnabled(update);
+      // If assured replication is configured, this will prepare blocking
+      // mechanism. If assured replication is disabled, this returns
+      // immediately
+      prepareWaitForAckIfAssuredEnabled(update);
 
-    publish(update);
+      publish(update);
+    }
 
     try
     {

--
Gitblit v1.10.0