From 4d0faf5b8ad46e978a72d35a8f736f83fb61fd2d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 30 Mar 2011 19:21:16 +0000
Subject: [PATCH] Fix issue OpenDJ-96: Replication server monitor data computation takes too long / blocks rest of server when another RS is cannot be reached

---
 opends/src/server/org/opends/server/replication/server/DataServerHandler.java |   78 ++++++++++++++++----------------------
 1 files changed, 33 insertions(+), 45 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
index e86dd20..3b9a4f7 100644
--- a/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/DataServerHandler.java
@@ -31,7 +31,6 @@
 import static org.opends.server.loggers.ErrorLogger.logError;
 import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
 import static org.opends.server.replication.common.StatusMachine.*;
-import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -301,52 +300,42 @@
         this.replicationServerDomain.getReplicationServer()
         .getMonitorInstanceName()));
 
-    try
+    MonitorData md = replicationServerDomain.getDomainMonitorData();
+
+    // Oldest missing update
+    Long approxFirstMissingDate = md.getApproxFirstMissingDate(serverId);
+    if ((approxFirstMissingDate != null) && (approxFirstMissingDate > 0))
     {
-      MonitorData md = replicationServerDomain.computeMonitorData(true);
-
-      // Oldest missing update
-      Long approxFirstMissingDate = md.getApproxFirstMissingDate(serverId);
-      if ((approxFirstMissingDate != null) && (approxFirstMissingDate > 0))
-      {
-        Date date = new Date(approxFirstMissingDate);
-        attributes.add(Attributes.create(
-            "approx-older-change-not-synchronized", date.toString()));
-        attributes.add(Attributes.create(
-            "approx-older-change-not-synchronized-millis", String
-            .valueOf(approxFirstMissingDate)));
-      }
-
-      // Missing changes
-      long missingChanges = md.getMissingChanges(serverId);
-      attributes.add(Attributes.create("missing-changes", String
-          .valueOf(missingChanges)));
-
-      // Replication delay
-      long delay = md.getApproxDelay(serverId);
-      attributes.add(Attributes.create("approximate-delay", String
-          .valueOf(delay)));
-
-      /* get the Server State */
-      AttributeBuilder builder = new AttributeBuilder("server-state");
-      ServerState state = md.getLDAPServerState(serverId);
-      if (state != null)
-      {
-        for (String str : state.toStringSet())
-        {
-          builder.add(str);
-        }
-        attributes.add(builder.toAttribute());
-      }
-
+      Date date = new Date(approxFirstMissingDate);
+      attributes.add(Attributes.create(
+          "approx-older-change-not-synchronized", date.toString()));
+      attributes.add(Attributes.create(
+          "approx-older-change-not-synchronized-millis", String
+          .valueOf(approxFirstMissingDate)));
     }
-    catch (Exception e)
+
+    // Missing changes
+    long missingChanges = md.getMissingChanges(serverId);
+    attributes.add(Attributes.create("missing-changes", String
+        .valueOf(missingChanges)));
+
+    // Replication delay
+    long delay = md.getApproxDelay(serverId);
+    attributes.add(Attributes.create("approximate-delay", String
+        .valueOf(delay)));
+
+    /* get the Server State */
+    AttributeBuilder builder = new AttributeBuilder("server-state");
+    ServerState state = md.getLDAPServerState(serverId);
+    if (state != null)
     {
-      Message message =
-        ERR_ERROR_RETRIEVING_MONITOR_DATA.get(stackTraceToSingleLineString(e));
-      // We failed retrieving the monitor data.
-      attributes.add(Attributes.create("error", message.toString()));
+      for (String str : state.toStringSet())
+      {
+        builder.add(str);
+      }
+      attributes.add(builder.toAttribute());
     }
+
     return attributes;
   }
 
@@ -494,8 +483,7 @@
        * to old connection. This must be done before taking the domain lock so
        * that the reader thread has a chance to stop the handler.
        */
-      replicationServerDomain.
-      waitDisconnection(inServerStartMsg.getServerId());
+      replicationServerDomain.waitDisconnection(inServerStartMsg.getServerId());
 
       // lock with no timeout
       lockDomain(false);

--
Gitblit v1.10.0