From c02dd7f87e9ba574f06e5cc1eb36ebeb76b9f446 Mon Sep 17 00:00:00 2001
From: mrossign <mrossign@localhost>
Date: Thu, 08 Oct 2009 16:02:17 +0000
Subject: [PATCH] - Addition of ReplServerStartDSMsg now sent to a DS connecting to a RS  in handshake phase instead of a ReplServerStartMsg. ReplServerStartDSMsg  contains same thing as ReplServerStartMsg but also contains

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index 8cd9f1a..c093c86 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -189,6 +189,21 @@
   final private Object domainMonitor = new Object();
 
   /**
+   * The weight affected to the replication server.
+   * Each replication server of the topology has a weight. When combined
+   * together, the weights of the replication servers of a same group can be
+   * translated to a percentage that determines the quantity of directory
+   * servers of the topology that should be connected to a replication server.
+   * For instance imagine a topology with 3 replication servers (with the same
+   * group id) with the following weights: RS1=1, RS2=1, RS3=2. This means that
+   * RS1 should have 25% of the directory servers connected in the topology,
+   * RS2 25%, and RS3 50%. This may be useful if the replication servers of the
+   * topology have a different power and one wants to spread the load between
+   * the replication servers according to their power.
+   */
+  private int weight = 1;
+
+  /**
    * Creates a new Replication server using the provided configuration entry.
    *
    * @param configuration The configuration of this replication server.
@@ -979,6 +994,13 @@
       }
     }
 
+    // Set a potential new weight
+    if (weight != configuration.getWeight())
+    {
+      weight = configuration.getWeight();
+      // TODO: send new TopologyMsg
+    }
+
     if ((configuration.getReplicationDBDirectory() != null) &&
         (!dbDirname.equals(configuration.getReplicationDBDirectory())))
     {
@@ -1786,4 +1808,13 @@
     }
     return result;
   }
+
+  /**
+   * Gets the weight.
+   * @return the weight
+   */
+  public int getWeight()
+  {
+    return weight;
+  }
 }

--
Gitblit v1.10.0