From 87e069074e41b0008cf0b549fce36b7dc4fcae30 Mon Sep 17 00:00:00 2001
From: fdorson <fdorson@localhost>
Date: Mon, 07 Jul 2008 14:45:19 +0000
Subject: [PATCH] 2nd try: fix for issue #3317 : Removing replication links requires re-start of the server and issue #3363 : NullPointerException in ReplicationBroker.java
---
opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
index 5c11a47..7c010a3 100644
--- a/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -2248,12 +2248,14 @@
disabled = true;
// Stop the listener thread
- listenerThread.shutdown();
+ if (listenerThread != null)
+ listenerThread.shutdown();
broker.stop(); // This will cut the session and wake up the listener
// Wait for the listener thread to stop
- listenerThread.waitForShutdown();
+ if (listenerThread != null)
+ listenerThread.waitForShutdown();
}
/**
@@ -3456,15 +3458,35 @@
// server id and base dn are readonly.
// isolationPolicy can be set immediately and will apply
// to the next updates.
- // The other parameters needs to be renegociated with the ReplicationServer.
+ // The other parameters needs to be renegociated with the ReplicationServer
// so that requires restarting the session with the ReplicationServer.
- replicationServers = configuration.getReplicationServer();
+ Boolean needToRestartSession = false;
+ Collection<String> newReplServers = configuration.getReplicationServer();
+
+ // A new session is necessary only when information regarding
+ // the connection is modified
+ if ((!(replicationServers.size() == newReplServers.size()
+ && replicationServers.containsAll(newReplServers))) ||
+ window != configuration.getWindowSize() ||
+ heartbeatInterval != configuration.getHeartbeatInterval())
+ needToRestartSession = true;
+
+ replicationServers = newReplServers;
window = configuration.getWindowSize();
heartbeatInterval = configuration.getHeartbeatInterval();
broker.changeConfig(replicationServers, maxReceiveQueue, maxReceiveDelay,
- maxSendQueue, maxSendDelay, window, heartbeatInterval);
+ maxSendQueue, maxSendDelay, window, heartbeatInterval);
isolationpolicy = configuration.getIsolationPolicy();
+ // To be able to stop and restart the broker properly just
+ // disable and enable the domain. That way a new session
+ // with the new configuration is available.
+ if (needToRestartSession)
+ {
+ this.disable();
+ this.enable();
+ }
+
return new ConfigChangeResult(ResultCode.SUCCESS, false);
}
--
Gitblit v1.10.0