hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r588083 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/util/ReflectionUtils.java
Date Wed, 24 Oct 2007 23:31:50 GMT
Author: omalley
Date: Wed Oct 24 16:31:49 2007
New Revision: 588083

URL: http://svn.apache.org/viewvc?rev=588083&view=rev
Log:
HADOOP-1898.  Release the lock protecting the last time of the last stack
dump while the dump is happening. Contributed by Amareshwari Sri Ramadasu.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ReflectionUtils.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=588083&r1=588082&r2=588083&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Oct 24 16:31:49 2007
@@ -24,6 +24,11 @@
     HADOOP-1604.  An system administrator can finalize namenode upgrades 
     without running the cluster. (Konstantin Shvachko via dhruba)
 
+  OPTIMIZATIONS
+
+    HADOOP-1898.  Release the lock protecting the last time of the last stack
+    dump while the dump is happening. (Amareshwari Sri Ramadasu via omalley)
+
 Branch 0.15 (unreleased changes)
 
   INCOMPATIBLE CHANGES

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ReflectionUtils.java?rev=588083&r1=588082&r2=588083&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ReflectionUtils.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/ReflectionUtils.java Wed Oct 24 16:31:49
2007
@@ -151,13 +151,19 @@
    * @param title a descriptive title for the call stacks
    * @param minInterval the minimum time from the last 
    */
-  public static synchronized void logThreadInfo(Log log,
-                                                String title,
-                                                long minInterval) {
+  public static void logThreadInfo(Log log,
+                                   String title,
+                                   long minInterval) {
+    boolean dumpStack = false;
     if (log.isInfoEnabled()) {
-      long now = System.currentTimeMillis();
-      if (now - previousLogTime >= minInterval * 1000) {
-        previousLogTime = now;
+      synchronized (ReflectionUtils.class) {
+        long now = System.currentTimeMillis();
+        if (now - previousLogTime >= minInterval * 1000) {
+          previousLogTime = now;
+          dumpStack = true;
+        }
+      }
+      if (dumpStack) {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
         printThreadInfo(new PrintWriter(buffer), title);
         log.info(buffer.toString());



Mime
View raw message