From b4c27fccb2913620731a9296b04baccb69846ac7 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Tue, 19 Jan 2010 09:53:03 +0000
Subject: [PATCH] This is about refactoring the way the directory server chooses the  replication server it will connect to. This also introduces a new  (weighed) load balancing feature that spreads DS connections across the  RSs, according to the RS weights defined by the administrator,

---
 opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java b/opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java
index 61df06a..f487638 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Copyright 2006-2010 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.common;
 
@@ -126,7 +126,7 @@
    * of a server state.
    *
    * @param in the byte array where to calculate the string.
-   * @param pos the position whre to start from in the byte array.
+   * @param pos the position where to start from in the byte array.
    * @return the length of the next string.
    * @throws DataFormatException If the byte array does not end with null.
    */
@@ -174,6 +174,33 @@
   }
 
   /**
+   * Update the Server State with a Server State. Every change number of this
+   * object is updated with the change number of the passed server state if
+   * it is newer.
+   *
+   * @param serverState the server state to use for the update.
+   *
+   * @return a boolean indicating if the update was meaningful.
+   */
+  public boolean update(ServerState serverState)
+  {
+    if (serverState == null)
+      return false;
+
+    boolean updated = false;
+
+    for (ChangeNumber cn : serverState.list.values())
+    {
+      if (update(cn))
+      {
+        updated = true;
+      }
+    }
+
+    return updated;
+  }
+
+  /**
    * Replace the Server State with another ServerState.
    *
    * @param serverState The ServerState.

--
Gitblit v1.10.0