From bd724fad0c954f1e607a0a90cbca3eb41d1f2460 Mon Sep 17 00:00:00 2001
From: pgamba <pgamba@localhost>
Date: Mon, 17 Sep 2007 08:00:37 +0000
Subject: [PATCH] Fixes repl init and total update #2253 #845 #1733
---
opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 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 7a445bf..57f9a7e 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -130,6 +130,14 @@
// ID of the backend
private static final String backendId = "replicationChanges";
+ // At startup, the listen thread wait on this flag for the connet
+ // thread to look for other servers in the topology.
+ // TODO when a replication server is out of date (has old changes
+ // to receive from other servers, the listen thread should not accept
+ // connection from ldap servers. (issue 1302)
+ private boolean connectedInTopology = false;
+ private final Object connectedInTopologyLock = new Object();
+
/**
* The tracer object for the debug logger.
*/
@@ -211,6 +219,23 @@
void runListen()
{
Socket newSocket;
+
+ // wait for the connect thread to find other replication
+ // servers in the topology before starting to accept connections
+ // from the ldap servers.
+ synchronized (connectedInTopologyLock)
+ {
+ if (connectedInTopology == false)
+ {
+ try
+ {
+ connectedInTopologyLock.wait(1000);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ }
+
while ((shutdown == false) && (stopListen == false))
{
// Wait on the replicationServer port.
@@ -286,6 +311,15 @@
}
}
}
+ synchronized (connectedInTopologyLock)
+ {
+ // wake up the listen thread if necessary.
+ if (connectedInTopology == false)
+ {
+ connectedInTopologyLock.notify();
+ connectedInTopology = true;
+ }
+ }
try
{
synchronized (this)
@@ -391,7 +425,7 @@
// FIXME : Is it better to have the time to receive the ReplServerInfo
// from all the other replication servers since this info is necessary
// to route an early received total update request.
-
+ try { Thread.sleep(300);} catch(Exception e) {}
if (debugEnabled())
TRACER.debugInfo("RS " +getMonitorInstanceName()+
" creates listen threads");
@@ -798,6 +832,7 @@
// Add the replication backend
DirectoryServer.getConfigHandler().addEntry(backendConfigEntry, null);
}
+ ldifImportConfig.close();
}
catch(Exception e)
{
--
Gitblit v1.10.0