hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r517414 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
Date Mon, 12 Mar 2007 21:47:52 GMT
Author: tomwhite
Date: Mon Mar 12 14:47:51 2007
New Revision: 517414

URL: http://svn.apache.org/viewvc?view=rev&rev=517414
Log:
HADOOP-1112.  Fix a race condition in Hadoop metrics.  Contributed by David Bowen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=517414&r1=517413&r2=517414
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Mar 12 14:47:51 2007
@@ -39,6 +39,10 @@
 11. HADOOP-1092.  Fix a NullPointerException in HeartbeatMonitor
     thread. (Hairong Kuang via tomwhite)
 
+12. HADOOP-1112.  Fix a race condition in Hadoop metrics.
+    (David Bowen via tomwhite)
+
+
 Release 0.12.0 - 2007-03-02
 
  1. HADOOP-975.  Separate stdout and stderr from tasks.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java?view=diff&rev=517414&r1=517413&r2=517414
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
(original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
Mon Mar 12 14:47:51 2007
@@ -323,7 +323,7 @@
         //Map<String,MetricValue> metricUpdates = record.getMetricTable();
         Map metricUpdates = record.getMetricTable();
         
-        RecordMap recordMap = (RecordMap) bufferedData.get(recordName);
+        RecordMap recordMap = getRecordMap(recordName);
         synchronized (recordMap) {
             MetricMap metricMap = (MetricMap) recordMap.get(tagTable);
             if (metricMap == null) {
@@ -349,6 +349,10 @@
         }
     }
     
+    private synchronized RecordMap getRecordMap(String recordName) {
+        return (RecordMap) bufferedData.get(recordName);
+    }
+    
     /**
      * Adds two numbers, coercing the second to the type of the first.
      *
@@ -382,7 +386,7 @@
         String recordName = record.getRecordName();
         TagMap tagTable = record.getTagTable();
         
-        RecordMap recordMap = (RecordMap) bufferedData.get(recordName);
+        RecordMap recordMap = getRecordMap(recordName);
         synchronized (recordMap) {
             recordMap.remove(tagTable);
         }



Mime
View raw message