From 26ff1f0755680cbce7b5bdb136750b2b1bc9e4ed Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 10 Nov 2006 08:05:56 +0000
Subject: [PATCH] issue 508  These changes implement a window mechanism in the sycnhronization protocol.

---
 opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java |   62 ++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java b/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
index 7b401b2..766359b 100644
--- a/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
+++ b/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
@@ -138,6 +138,7 @@
   static String MAX_RECEIVE_DELAY = "ds-cfg-max-receive-delay";
   static String MAX_SEND_QUEUE = "ds-cfg-max-send-queue";
   static String MAX_SEND_DELAY = "ds-cfg-max-send-delay";
+  static String WINDOW_SIZE = "ds-cfg-window-size";
 
   private static final StringConfigAttribute changelogStub =
     new StringConfigAttribute(CHANGELOG_SERVER_ATTR,
@@ -275,6 +276,20 @@
       configAttributes.add(maxSendDelayAttr);
     }
 
+    Integer window;
+    IntegerConfigAttribute windowStub =
+      new IntegerConfigAttribute(WINDOW_SIZE, "window size",
+                                 false, false, false, true, 0, false, 0);
+    IntegerConfigAttribute windowAttr =
+      (IntegerConfigAttribute) configEntry.getConfigAttribute(windowStub);
+    if (windowAttr == null)
+      window = 100;  // Attribute is not present : use the default value
+    else
+    {
+      window = windowAttr.activeIntValue();
+      configAttributes.add(windowAttr);
+    }
+
     configDn = configEntry.getDN();
     DirectoryServer.registerConfigurableComponent(this);
 
@@ -292,7 +307,7 @@
     try
     {
       broker = new ChangelogBroker(state, baseDN, serverId, maxReceiveQueue,
-          maxReceiveDelay, maxSendQueue, maxSendDelay);
+          maxReceiveDelay, maxSendQueue, maxSendDelay, window);
       synchronized (broker)
       {
         broker.start(changelogServers);
@@ -882,10 +897,7 @@
    */
   public int getPendingUpdatesCount()
   {
-    synchronized (pendingChanges)
-    {
-      return pendingChanges.size();
-    }
+    return pendingChanges.size();
   }
 
   /**
@@ -1662,4 +1674,44 @@
     }
     return true;
   }
+
+  /**
+   * Get the maximum receive window size.
+   *
+   * @return The maximum receive window size.
+   */
+  public int getMaxRcvWindow()
+  {
+    return broker.getMaxRcvWindow();
+  }
+
+  /**
+   * Get the current receive window size.
+   *
+   * @return The current receive window size.
+   */
+  public int getCurrentRcvWindow()
+  {
+    return broker.getCurrentRcvWindow();
+  }
+
+  /**
+   * Get the maximum send window size.
+   *
+   * @return The maximum send window size.
+   */
+  public int getMaxSendWindow()
+  {
+    return broker.getMaxSendWindow();
+  }
+
+  /**
+   * Get the current send window size.
+   *
+   * @return The current send window size.
+   */
+  public int getCurrentSendWindow()
+  {
+    return broker.getCurrentSendWindow();
+  }
 }

--
Gitblit v1.10.0