From 29a29c4fb099630685df243f32330968be6a1954 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 17 Mar 2009 14:23:26 +0000
Subject: [PATCH] fix for 3315 : dsreplication initialize-all returns before peer has completed initialization

---
 opends/src/server/org/opends/server/replication/service/ReplicationDomain.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 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 883ae97..4cb0350 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -1199,6 +1199,33 @@
   throws DirectoryException
   {
     initializeRemote(target, serverID, initTask);
+
+    if (target == RoutableMsg.ALL_SERVERS)
+    {
+      // Check for the status of all remote servers to check if they
+      // are all finished with the import.
+      boolean done = true;
+      do
+      {
+        done = true;
+        for (DSInfo dsi : getReplicasList())
+        {
+          if (dsi.getStatus() == ServerStatus.FULL_UPDATE_STATUS)
+          {
+            done = false;
+            try
+            {
+              Thread.sleep(100);
+            } catch (InterruptedException e)
+            {
+              // just loop again.
+            }
+            break;
+          }
+        }
+      }
+      while (!done);
+    }
   }
 
   /**

--
Gitblit v1.10.0