From 455897cc245b67d929f409a93cfa7106e835cc1f Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 01 Mar 2007 03:27:06 +0000
Subject: [PATCH] This removes old debug logging framework method calls that are going to be automatically instrumented by AspectJ. Non instrumented debug method calls are updated to use the new debug framework methods. However, the new debug logging framework is not yet active as the Aspects are not weaved in. After this revision, debug logging will be disabled in the server until the new AOP framework is complete. 

---
 opends/src/server/org/opends/server/synchronization/protocol/HeartbeatThread.java |   56 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/opends/src/server/org/opends/server/synchronization/protocol/HeartbeatThread.java b/opends/src/server/org/opends/server/synchronization/protocol/HeartbeatThread.java
index 1121dad..19ce2a1 100644
--- a/opends/src/server/org/opends/server/synchronization/protocol/HeartbeatThread.java
+++ b/opends/src/server/org/opends/server/synchronization/protocol/HeartbeatThread.java
@@ -28,10 +28,9 @@
 package org.opends.server.synchronization.protocol;
 
 import org.opends.server.api.DirectoryThread;
-import static org.opends.server.loggers.Debug.debugMessage;
-import static org.opends.server.types.DebugLogCategory.SYNCHRONIZATION;
-import static org.opends.server.types.DebugLogSeverity.INFO;
-import static org.opends.server.types.DebugLogSeverity.VERBOSE;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugVerbose;
+import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
 
 import java.io.IOException;
 
@@ -42,12 +41,6 @@
  */
 public class HeartbeatThread extends DirectoryThread
 {
-  /**
-   * The fully-qualified name of this class for debugging purposes.
-   */
-  private static final String CLASS_NAME =
-       "org.opends.server.synchronization.plugin.HeartbeatThread";
-
 
   /**
    * For test purposes only to simulate loss of heartbeats.
@@ -95,25 +88,30 @@
   {
     try
     {
-      debugMessage(SYNCHRONIZATION, INFO, CLASS_NAME, "run",
-                   "Heartbeat thread is starting, interval is " +
-                        heartbeatInterval);
+      if (debugEnabled())
+      {
+        debugInfo("Heartbeat thread is starting, interval is %d",
+                  heartbeatInterval);
+      }
       HeartbeatMessage heartbeatMessage = new HeartbeatMessage();
 
       while (!shutdown)
       {
         long now = System.currentTimeMillis();
-        debugMessage(SYNCHRONIZATION, VERBOSE, CLASS_NAME, "run",
-                     "Heartbeat thread awoke at " + now +
-                          ", last message was sent at " +
-                          session.getLastPublishTime());
+        if (debugEnabled())
+        {
+          debugVerbose("Heartbeat thread awoke at %d, last message was sent " +
+              "at %d", now, session.getLastPublishTime());
+        }
 
         if (now > session.getLastPublishTime() + heartbeatInterval)
         {
           if (!heartbeatsDisabled)
           {
-            debugMessage(SYNCHRONIZATION, VERBOSE, CLASS_NAME, "run",
-                         "Heartbeat sent at " + now);
+            if (debugEnabled())
+            {
+              debugVerbose("Heartbeat sent at %d", now);
+            }
             session.publish(heartbeatMessage);
           }
         }
@@ -121,14 +119,16 @@
         try
         {
           long sleepTime = session.getLastPublishTime() +
-               heartbeatInterval - now;
+              heartbeatInterval - now;
           if (sleepTime <= 0)
           {
             sleepTime = heartbeatInterval;
           }
 
-          debugMessage(SYNCHRONIZATION, VERBOSE, CLASS_NAME, "run",
-                       "Heartbeat thread sleeping for " + sleepTime);
+          if (debugEnabled())
+          {
+            debugVerbose("Heartbeat thread sleeping for %d", sleepTime);
+          }
           Thread.sleep(sleepTime);
         }
         catch (InterruptedException e)
@@ -139,14 +139,18 @@
     }
     catch (IOException e)
     {
-      debugMessage(SYNCHRONIZATION, INFO, CLASS_NAME, "run",
-                   "Heartbeat thread could not send a heartbeat.");
+      if (debugEnabled())
+      {
+        debugInfo("Heartbeat thread could not send a heartbeat.");
+      }
       // This will be caught in another thread.
     }
     finally
     {
-      debugMessage(SYNCHRONIZATION, INFO, CLASS_NAME, "run",
-                   "Heartbeat thread is exiting.");
+      if (debugEnabled())
+      {
+        debugInfo("Heartbeat thread is exiting.");
+      }
     }
   }
 

--
Gitblit v1.10.0