From f312ec4a15ca08a406c045748e9d627fe1e31494 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 17 Nov 2006 13:46:39 +0000
Subject: [PATCH] The synchronization changelog monitoring information has a counter named waiting-changes that publish the number of updates known by the changelog server that have not yest been sent to each ldap server because they are too slow to replay them.

---
 opendj-sdk/opends/src/server/org/opends/server/synchronization/changelog/Changelog.java |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/synchronization/changelog/Changelog.java b/opendj-sdk/opends/src/server/org/opends/server/synchronization/changelog/Changelog.java
index b90ea1d..2a74fb9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/synchronization/changelog/Changelog.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/synchronization/changelog/Changelog.java
@@ -98,11 +98,13 @@
           new ArrayList<ConfigAttribute>();
   private ChangelogDbEnv dbEnv;
   private int rcvWindow;
+  private int queueSize;
 
   static final String CHANGELOG_SERVER_ATTR = "ds-cfg-changelog-server";
   static final String SERVER_ID_ATTR = "ds-cfg-changelog-server-id";
   static final String CHANGELOG_PORT_ATTR = "ds-cfg-changelog-port";
   static final String WINDOW_SIZE_ATTR = "ds-cfg-window-size";
+  static final String QUEUE_SIZE_ATTR = "ds-cfg-changelog-max-queue-size";
 
   static final IntegerConfigAttribute changelogPortStub =
     new IntegerConfigAttribute(CHANGELOG_PORT_ATTR, "changelog port",
@@ -122,6 +124,10 @@
     new IntegerConfigAttribute(WINDOW_SIZE_ATTR, "window size",
                                false, false, false, true, 0, false, 0);
 
+  static final IntegerConfigAttribute queueSizeStub =
+    new IntegerConfigAttribute(QUEUE_SIZE_ATTR, "changelog queue size",
+                               false, false, false, true, 0, false, 0);
+
   /**
    * Check if a ConfigEntry is valid.
    * @param config The config entry that needs to be checked.
@@ -247,6 +253,16 @@
       configAttributes.add(windowAttr);
     }
 
+    IntegerConfigAttribute queueSizeAttr =
+      (IntegerConfigAttribute) config.getConfigAttribute(queueSizeStub);
+    if (queueSizeAttr == null)
+      queueSize = 10000;  // Attribute is not present : use the default value
+    else
+    {
+      queueSize = queueSizeAttr.activeIntValue();
+      configAttributes.add(queueSizeAttr);
+    }
+
     initialize(changelogServerId, changelogPort);
 
     configDn = config.getDN();
@@ -325,7 +341,7 @@
         newSocket =  listenSocket.accept();
         newSocket.setReceiveBufferSize(1000000);
         ServerHandler handler = new ServerHandler(
-                                     new SocketSession(newSocket));
+                                     new SocketSession(newSocket), queueSize);
         handler.start(null, serverId, serverURL, rcvWindow, this);
       } catch (IOException e)
       {
@@ -401,7 +417,7 @@
       socket.connect(ServerAddr, 500);
 
       ServerHandler handler = new ServerHandler(
-                                      new SocketSession(socket));
+                                      new SocketSession(socket), queueSize);
       handler.start(baseDn, serverId, serverURL, rcvWindow, this);
     }
     catch (IOException e)

--
Gitblit v1.10.0