From 00181855b3818159d287d1c3523b06c3bc3f3e4a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 13 Apr 2011 22:24:13 +0000
Subject: [PATCH] Another fix for OpenDJ-97: Very many minor problems with the error logging for replication

---
 opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java |   20 +++++++++++++-------
 opendj-sdk/opends/src/messages/messages/replication.properties                            |    4 +++-
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/replication.properties b/opendj-sdk/opends/src/messages/messages/replication.properties
index 00014bc..8e31ab8 100644
--- a/opendj-sdk/opends/src/messages/messages/replication.properties
+++ b/opendj-sdk/opends/src/messages/messages/replication.properties
@@ -538,4 +538,6 @@
  application connecting to this replication server. The error was: %s
 SEVERE_WARN_MISSING_REMOTE_MONITOR_DATA_106=Timed out waiting for monitor data \
  for the domain "%s" from replication server RS(%d)
-
+NOTICE_LOAD_BALANCE_REPLICATION_SERVER_213=Directory Server DS(%d) is disconnecting \
+ from replication server RS(%d) at %s for domain "%s" in order to find another \
+ replication server in the topology and distribute load more equally
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java b/opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
index 347158c..1e8de0f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -2601,15 +2601,21 @@
               {
                 // The best replication server is no more the one we are
                 // currently using. Disconnect properly then reconnect.
-                int bestServerId = -1;
-                if (bestServerInfo != null)
+                Message message;
+                if (bestServerInfo == null)
                 {
-                  bestServerId = bestServerInfo.getServerId();
+                  message = NOTE_LOAD_BALANCE_REPLICATION_SERVER.get(
+                      serverId, replicationServerID,
+                      failingSession.getReadableRemoteAddress(),
+                      baseDn);
                 }
-                Message message = NOTE_NEW_BEST_REPLICATION_SERVER
-                    .get(serverId, replicationServerID,
-                        failingSession.getReadableRemoteAddress(),
-                        bestServerId, baseDn);
+                else
+                {
+                  message = NOTE_NEW_BEST_REPLICATION_SERVER.get(
+                      serverId, replicationServerID,
+                      failingSession.getReadableRemoteAddress(),
+                      bestServerInfo.getServerId(), baseDn);
+                }
                 logError(message);
                 reStart(true);
               }

--
Gitblit v1.10.0