hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: Revert "HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula."
Date Tue, 24 Nov 2015 19:18:25 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 85d04dc46 -> 792313011


Revert "HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed
by Brahma Reddy Battula."

This reverts commit 4356e8a5ef0ac6d11a34704b80ef360a710e623a.

Conflicts:

	hadoop-common-project/hadoop-common/CHANGES.txt
	hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
(cherry picked from commit 17b1a5482b32dab82225e8233648990bc77674ba)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/79231301
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/79231301
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/79231301

Branch: refs/heads/branch-2
Commit: 7923130114c1b9a8e8086809065b9f6cc9860df3
Parents: 85d04dc
Author: Jason Lowe <jlowe@apache.org>
Authored: Tue Nov 24 19:12:04 2015 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Tue Nov 24 19:13:26 2015 +0000

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt    |  3 ---
 .../hadoop/metrics2/impl/MetricsSourceAdapter.java | 17 ++++++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/79231301/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a300c50..66b8870 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -871,9 +871,6 @@ Release 2.7.3 - UNRELEASED
     HADOOP-12374. Updated expunge command description.
     (WeiWei Yang via eyang)
 
-    HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache.
-    (Brahma Reddy Battula via ozawa)
-
     HADOOP-12348. MetricsSystemImpl creates MetricsSourceAdapter with wrong
     time unit parameter. (zxu via rkanter)
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/79231301/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
index 706ef7e..d56ee53 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
@@ -158,7 +158,7 @@ class MetricsSourceAdapter implements DynamicMBean {
 
   private void updateJmxCache() {
     boolean getAllMetrics = false;
-    synchronized (this) {
+    synchronized(this) {
       if (Time.now() - jmxCacheTS >= jmxCacheTTL) {
         // temporarilly advance the expiry while updating the cache
         jmxCacheTS = Time.now() + jmxCacheTTL;
@@ -169,21 +169,24 @@ class MetricsSourceAdapter implements DynamicMBean {
           getAllMetrics = true;
           lastRecsCleared = false;
         }
-      } else {
+      }
+      else {
         return;
       }
+    }
 
-      if (getAllMetrics) {
-        MetricsCollectorImpl builder = new MetricsCollectorImpl();
-        getMetrics(builder, true);
-      }
+    if (getAllMetrics) {
+      MetricsCollectorImpl builder = new MetricsCollectorImpl();
+      getMetrics(builder, true);
+    }
 
+    synchronized(this) {
       updateAttrCache();
       if (getAllMetrics) {
         updateInfoCache();
       }
       jmxCacheTS = Time.now();
-      lastRecs = null; // in case regular interval update is not running
+      lastRecs = null;  // in case regular interval update is not running
       lastRecsCleared = true;
     }
   }


Mime
View raw message