You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by oz...@apache.org on 2015/05/14 03:21:13 UTC
hadoop git commit: HADOOP-11361. Fix a race condition in
MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula.
Repository: hadoop
Updated Branches:
refs/heads/trunk 0e85044e2 -> 4356e8a5e
HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4356e8a5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4356e8a5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4356e8a5
Branch: refs/heads/trunk
Commit: 4356e8a5ef0ac6d11a34704b80ef360a710e623a
Parents: 0e85044
Author: Tsuyoshi Ozawa <oz...@apache.org>
Authored: Thu May 14 10:20:45 2015 +0900
Committer: Tsuyoshi Ozawa <oz...@apache.org>
Committed: Thu May 14 10:20:45 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/4356e8a5/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 207d144..5e6b9ea 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -674,6 +674,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-11962. Sasl message with MD5 challenge text shouldn't be LOG out
even in debug level. (Junping Du via wheat9)
+ HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache.
+ (Brahma Reddy Battula via ozawa)
+
Release 2.7.1 - UNRELEASED
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4356e8a5/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 cae9c3d..f3ddc91 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
}
}