From a733cedcf54ab0b979f7f1b762d086e49bd59d72 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 27 Oct 2009 09:34:04 +0000
Subject: [PATCH] Fix for issue 4316 : Replication takes too much time to shutdown
---
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 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 9b8f67d..992fe7c 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -79,6 +79,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.replication.common.AssuredMode;
import org.opends.server.replication.common.ChangeNumber;
+import org.opends.server.replication.common.MutableBoolean;
import org.opends.server.replication.common.ServerState;
import org.opends.server.replication.common.ServerStatus;
import org.opends.server.replication.common.StatusMachine;
@@ -309,7 +310,7 @@
* This object is used as a conditional event to be notified about
* the reception of monitor information from the Replication Server.
*/
- private Object monitorResponse = new Object();
+ private final MutableBoolean monitorResponse = new MutableBoolean(false);
/**
@@ -585,6 +586,8 @@
*/
public Map<Integer, ServerState> getReplicaStates()
{
+ monitorResponse.set(false);
+
// publish Monitor Request Message to the Replication Server
broker.publish(new MonitorRequestMsg(serverID, broker.getRsServerId()));
@@ -593,7 +596,10 @@
{
synchronized (monitorResponse)
{
- monitorResponse.wait(10000);
+ if (monitorResponse.get() == false)
+ {
+ monitorResponse.wait(10000);
+ }
}
} catch (InterruptedException e)
{}
@@ -844,6 +850,7 @@
// Notify the sender that the response was received.
synchronized (monitorResponse)
{
+ monitorResponse.set(true);
monitorResponse.notify();
}
}
@@ -1901,6 +1908,18 @@
disableService();
enableService();
+ // wait for the domain to reconnect.
+ int count = 0;
+ while (!isConnected() && (count < 10))
+ {
+ try
+ {
+ Thread.sleep(100);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+
resetGenerationId(getGenerationID());
// check that at least one ReplicationServer did change its generation-id
--
Gitblit v1.10.0