From 042cb4492e64fed84141f94b0c969234465fc74d Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 14 Aug 2013 11:14:13 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java |   56 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
index 12ba75d..3b8daa7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
@@ -27,15 +27,14 @@
  */
 package org.opends.server.replication.server;
 
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
-
 import org.opends.server.api.DirectoryThread;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.replication.common.ServerStatus;
 import org.opends.server.replication.common.StatusMachineEvent;
 import org.opends.server.types.DebugLogLevel;
 
+import static org.opends.server.loggers.debug.DebugLogger.*;
+
 /**
  * This thread is in charge of periodically determining if the connected
  * directory servers of the domain it is associated with are late or not
@@ -59,7 +58,7 @@
   private final ReplicationServerDomain replicationServerDomain;
   private volatile int degradedStatusThreshold = -1;
 
-  // Sleep time for the thread, in ms.
+  /** Sleep time for the thread, in ms. */
   private static final int STATUS_ANALYZER_SLEEP_TIME = 5000;
 
   private volatile boolean done = false;
@@ -77,9 +76,9 @@
     int degradedStatusThreshold)
   {
     super("Replication server RS("
-        + replicationServerDomain.getReplicationServer()
-            .getServerId() + ") delay monitor for domain \""
-        + replicationServerDomain.getBaseDn() + "\"");
+        + replicationServerDomain.getLocalRSServerId()
+        + ") delay monitor for domain \"" + replicationServerDomain.getBaseDn()
+        + "\"");
 
     this.replicationServerDomain = replicationServerDomain;
     this.degradedStatusThreshold = degradedStatusThreshold;
@@ -98,6 +97,7 @@
         replicationServerDomain.getBaseDn());
     }
 
+    final int localRsId = replicationServerDomain.getLocalRSServerId();
     boolean interrupted = false;
     while (!shutdown && !interrupted)
     {
@@ -132,11 +132,10 @@
         int nChanges = serverHandler.getRcvMsgQueueSize();
         if (debugEnabled())
         {
-          TRACER.debugInfo("Status analyzer for dn " +
-              replicationServerDomain.getBaseDn() + " DS " +
-            Integer.toString(serverHandler.getServerId()) + " has " + nChanges +
-            " message(s) in writer queue. This is in RS " +
-            replicationServerDomain.getReplicationServer().getServerId());
+          TRACER.debugInfo("Status analyzer for dn "
+              + replicationServerDomain.getBaseDn() + " DS "
+              + serverHandler.getServerId() + " has " + nChanges
+              + " message(s) in writer queue. This is in RS " + localRsId);
         }
 
         // Check status to know if it is relevant to change the status. Do not
@@ -161,10 +160,10 @@
               if (interrupted)
               {
                 // Finish job and let thread die
-                TRACER.debugInfo("Status analyzer for dn " +
-                    replicationServerDomain.getBaseDn() +
-                  " has been interrupted and will die. This is in RS " +
-                  replicationServerDomain.getReplicationServer().getServerId());
+                TRACER.debugInfo("Status analyzer for dn "
+                    + replicationServerDomain.getBaseDn()
+                    + " has been interrupted and will die. This is in RS "
+                    + localRsId);
                 break;
               }
             }
@@ -179,10 +178,10 @@
               if (interrupted)
               {
                 // Finish job and let thread die
-                TRACER.debugInfo("Status analyzer for dn " +
-                    replicationServerDomain.getBaseDn() +
-                  " has been interrupted and will die. This is in RS " +
-                  replicationServerDomain.getReplicationServer().getServerId());
+                TRACER.debugInfo("Status analyzer for dn "
+                    + replicationServerDomain.getBaseDn()
+                    + " has been interrupted and will die. This is in RS "
+                    + localRsId);
                 break;
               }
             }
@@ -192,10 +191,9 @@
     }
 
     done = true;
-    TRACER.debugInfo("Status analyzer for dn " +
-        replicationServerDomain.getBaseDn() + " is terminated." +
-      " This is in RS " +
-      replicationServerDomain.getReplicationServer().getServerId());
+    TRACER.debugInfo("Status analyzer for dn "
+        + replicationServerDomain.getBaseDn() + " is terminated."
+        + " This is in RS " + localRsId);
   }
 
   /**
@@ -211,8 +209,8 @@
       if (debugEnabled())
       {
         TRACER.debugInfo("Shutting down status analyzer for dn "
-            + replicationServerDomain.getBaseDn() + " in RS "
-            + replicationServerDomain.getReplicationServer().getServerId());
+            + replicationServerDomain.getBaseDn()
+            + " in RS " + replicationServerDomain.getLocalRSServerId());
       }
     }
   }
@@ -234,9 +232,9 @@
         if (n >= FACTOR)
         {
           TRACER.debugInfo("Interrupting status analyzer for dn " +
-            replicationServerDomain.getBaseDn() + " in RS " +
-            replicationServerDomain.getReplicationServer().getServerId());
-          this.interrupt();
+              replicationServerDomain.getBaseDn() + " in RS " +
+              replicationServerDomain.getLocalRSServerId());
+          interrupt();
         }
       }
     } catch (InterruptedException e)

--
Gitblit v1.10.0