From 18d8dd990ea2072267b32e3200c3291fdd53576a Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 23 Apr 2007 13:38:48 +0000
Subject: [PATCH] This integrates the multi-master synchronization with the new admin framework (issue 1477) and makes possible to dynamically add or remove changelog server and synchronization domains in a running server (issue 639).

---
 opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/ChangelogBroker.java |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/ChangelogBroker.java b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/ChangelogBroker.java
index a985e6b..674d94a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/ChangelogBroker.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/synchronization/plugin/ChangelogBroker.java
@@ -33,8 +33,8 @@
 import static org.opends.server.synchronization.common.LogMessages.*;
 import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
 
+import java.util.Collection;
 import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.TreeSet;
 import java.util.concurrent.Semaphore;
 import java.io.IOException;
@@ -75,7 +75,7 @@
 public class ChangelogBroker implements InternalSearchListener
 {
   private boolean shutdown = false;
-  private List<String> servers;
+  private Collection<String> servers;
   private boolean connected = false;
   private final Object lock = new Object();
   private String changelogServer = "Not connected";
@@ -158,7 +158,7 @@
    * @param servers list of servers used
    * @throws Exception : in case of errors
    */
-  public void start(List<String> servers)
+  public void start(Collection<String> servers)
                     throws Exception
   {
     /*
@@ -504,7 +504,6 @@
       try
       {
         SynchronizationMessage msg = session.receive();
-
         if (msg instanceof WindowMessage)
         {
           WindowMessage windowMsg = (WindowMessage) msg;
@@ -556,7 +555,8 @@
         debugInfo("ChangelogBroker Stop Closing session");
       }
 
-      session.close();
+      if (session != null)
+        session.close();
     } catch (IOException e)
     {}
   }
@@ -695,11 +695,31 @@
     return numLostConnections;
   }
 
-  private void log(String message)
+
+  /**
+   * Change some config parameters.
+   *
+   * @param changelogServers    The new list of changelog servers.
+   * @param maxReceiveQueue     The max size of receive queue.
+   * @param maxReceiveDelay     The max receive delay.
+   * @param maxSendQueue        The max send queue.
+   * @param maxSendDelay        The max Send Delay.
+   * @param window              The max window size.
+   * @param heartbeatInterval   The heartbeat interval.
+   */
+  public void changeConfig(Collection<String> changelogServers,
+      int maxReceiveQueue, int maxReceiveDelay, int maxSendQueue,
+      int maxSendDelay, int window, long heartbeatInterval)
   {
-    int    msgID   = MSGID_UNKNOWN_TYPE;
-    logError(ErrorLogCategory.SYNCHRONIZATION,
-           ErrorLogSeverity.SEVERE_ERROR,
-           message, msgID);
+    this.servers = changelogServers;
+    this.maxRcvWindow = window;
+    this.heartbeatInterval = heartbeatInterval;
+    this.maxReceiveDelay = maxReceiveDelay;
+    this.maxReceiveQueue = maxReceiveQueue;
+    this.maxSendDelay = maxSendDelay;
+    this.maxSendQueue = maxSendQueue;
+    // TODO : Changing those parameters requires to either restart a new
+    // session with the changelog server or renegociate the parameters that
+    // were sent in the ServerStart message
   }
 }

--
Gitblit v1.10.0