From 51ef33bebdaa4f8df31131374fce8433c431c298 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 16 Sep 2009 10:26:07 +0000
Subject: [PATCH] Fix a regression introduced by fix for 4223 During the creation of a replicationServerDomain, wait for the replication server  to connect to other replication servers only if the creation was initiated by a  directory server.

---
 opends/src/server/org/opends/server/replication/server/ReplicationServer.java |   44 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index 9ccb5ca..8c3dcd5 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -687,6 +687,25 @@
   public ReplicationServerDomain getReplicationServerDomain(String baseDn,
           boolean create)
   {
+    return getReplicationServerDomain(baseDn, create, false);
+  }
+
+  /**
+   * Get the ReplicationServerDomain associated to the base DN given in
+   * parameter.
+   *
+   * @param baseDn The base Dn for which the ReplicationServerDomain must be
+   * returned.
+   * @param create Specifies whether to create the ReplicationServerDomain if
+   *        it does not already exist.
+   * @param waitConnections     Waits for the Connections with other RS to
+   *                            be established before returning.
+   * @return The ReplicationServerDomain associated to the base DN given in
+   *         parameter.
+   */
+  public ReplicationServerDomain getReplicationServerDomain(String baseDn,
+          boolean create, boolean waitConnections)
+  {
     ReplicationServerDomain replicationServerDomain;
 
     synchronized (baseDNs)
@@ -698,18 +717,21 @@
         baseDNs.put(baseDn, replicationServerDomain);
         synchronized (domainMonitor)
         {
-          synchronized (this)
+          if (waitConnections)
           {
-            // kick up the connect thread so that this new domain
-            // gets connected to all the Replication Servers.
-            this.notify();
-          }
-          try
-          {
-            // wait for the connect thread to signal that it finished its job
-            domainMonitor.wait(500);
-          } catch (InterruptedException e)
-          {
+            synchronized (this)
+            {
+              // kick up the connect thread so that this new domain
+              // gets connected to all the Replication Servers.
+              this.notify();
+            }
+            try
+            {
+              // wait for the connect thread to signal that it finished its job
+              domainMonitor.wait(500);
+            } catch (InterruptedException e)
+            {
+            }
           }
         }
       }

--
Gitblit v1.10.0