james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r756418 - /james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java
Date Fri, 20 Mar 2009 11:24:00 GMT
Author: rdonkin
Date: Fri Mar 20 11:24:00 2009
New Revision: 756418

URL: http://svn.apache.org/viewvc?rev=756418&view=rev
Log:
Include trigger target in logging and make it clearer which names a thread JAMES-896 https://issues.apache.org/jira/browse/JAMES-896

Modified:
    james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java

Modified: james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java
URL: http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java?rev=756418&r1=756417&r2=756418&view=diff
==============================================================================
--- james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java
(original)
+++ james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/util/watchdog/InaccurateTimeoutWatchdog.java
Fri Mar 20 11:24:00 2009
@@ -99,7 +99,9 @@
      * Start this Watchdog, causing it to begin checking.
      */
     public void start() {
-        getLogger().debug("Calling start()");
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("[" + triggerTarget + "] Calling start()" );
+        }
         lastReset = System.currentTimeMillis();
         isChecking = true;
         synchronized(this) {
@@ -115,9 +117,9 @@
      */
     public void reset() {
         if (watchdogThread != null) {
-            getLogger().debug("Calling reset() " + watchdogThread.getName());
+            getLogger().debug("[" + triggerTarget + "] Calling reset() on thread '" + watchdogThread.getName()
+ "'");
         } else {
-            getLogger().debug("Calling reset() for inactive watchdog");
+            getLogger().debug("[" + triggerTarget + "] Calling reset() for inactive watchdog");
         }
         isReset = true;
     }
@@ -128,9 +130,9 @@
      */
     public void stop() {
         if (watchdogThread != null) {
-            getLogger().debug("Calling stop() " + watchdogThread.getName());
+            getLogger().debug("[" + triggerTarget + "] Calling stop() on thread '" + watchdogThread.getName()
+ "'");
         } else {
-            getLogger().debug("Calling stop() for inactive watchdog");
+            getLogger().debug("[" + triggerTarget + "] Calling stop() for inactive watchdog");
         }
         isChecking = false;
     }
@@ -147,7 +149,7 @@
                 try {
                     if (!isChecking) {
                         if (getLogger().isDebugEnabled()) {
-                            getLogger().debug("Watchdog " + Thread.currentThread().getName()
+ " is not active - going to exit.");
+                            getLogger().debug("[" + triggerTarget + "] Watchdog on thread
'" + Thread.currentThread().getName() + "' is not active - going to exit.");
                         }
                         synchronized (this) {
                             if (!isChecking) {
@@ -163,9 +165,9 @@
                         }
                         long timeToSleep = lastReset + timeout - currentTime;
                         if (watchdogThread != null) {
-                            getLogger().debug("Watchdog " + watchdogThread.getName() + "
has time to sleep " + timeToSleep);
+                            getLogger().debug("[" + triggerTarget + "] Watchdog on thread
'" + watchdogThread.getName() + "' has time to sleep " + timeToSleep);
                         } else {
-                            getLogger().debug("Watchdog has time to sleep " + timeToSleep);
+                            getLogger().debug("[" + triggerTarget + "] Watchdog has time
to sleep " + timeToSleep);
                         }
                         if (timeToSleep <= 0) {
                             try {
@@ -176,7 +178,7 @@
                                     watchdogThread = null;
                                 }
                             } catch (Throwable t) {
-                                getLogger().error("Encountered error while executing Watchdog
target.", t);
+                                getLogger().error("[" + triggerTarget + "] Encountered error
while executing Watchdog target.", t);
                             }
                             isChecking = false;
                             continue;
@@ -198,7 +200,9 @@
             // to the pool.
             Thread.interrupted();
         }
-        getLogger().debug("Watchdog " + Thread.currentThread().getName() + " is exiting run().");
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("[" + triggerTarget + "] Watchdog on thread '" + Thread.currentThread().getName()
+ "' is exiting run().");
+        }
     }
 
     /**
@@ -207,10 +211,12 @@
     public void dispose() {
         synchronized(this) {
             isChecking = false;
-            if (watchdogThread != null) {
-                getLogger().debug("Calling disposeWatchdog() " + watchdogThread.getName());
-            } else {
-                getLogger().debug("Calling disposeWatchdog() for inactive watchdog");
+            if (getLogger().isDebugEnabled()) {
+                if (watchdogThread != null) {
+                    getLogger().debug("[" + triggerTarget + "] Calling disposeWatchdog()
on thread '" + watchdogThread.getName() + "'");
+                } else {
+                    getLogger().debug("[" + triggerTarget + "] Calling disposeWatchdog()
for inactive watchdog");
+                }
             }
             if (watchdogThread != null) {
                 watchdogThread = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message