hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oz...@apache.org
Subject [1/3] hadoop git commit: HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula.
Date Sat, 14 Nov 2015 06:03:17 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 47dfb69a2 -> 929699f7e


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

(cherry picked from commit 4356e8a5ef0ac6d11a34704b80ef360a710e623a)

Conflicts:
	hadoop-common-project/hadoop-common/CHANGES.txt


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

Branch: refs/heads/branch-2.7
Commit: 2b7e6f7dfd09483770b44fd1d6ba4c7047b2cec0
Parents: 47dfb69
Author: Tsuyoshi Ozawa <ozawa@apache.org>
Authored: Thu May 14 10:20:45 2015 +0900
Committer: Tsuyoshi Ozawa <ozawa@apache.org>
Committed: Sat Nov 14 14:48:33 2015 +0900

----------------------------------------------------------------------
 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/2b7e6f7d/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 9fccee9..f7a5ef7 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -25,6 +25,9 @@ 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)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b7e6f7d/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 b0b758c..63a5782 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
@@ -154,31 +154,28 @@ 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;
         if (lastRecs == null) {
           getAllMetrics = true;
         }
-      }
-      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
     }
   }
 


Mime
View raw message