Revert "HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula."
This reverts commit4356e8a5ef
. 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 commit17b1a5482b
)
This commit is contained in:
parent
85d04dc464
commit
7923130114
|
@ -871,9 +871,6 @@ Release 2.7.3 - UNRELEASED
|
||||||
HADOOP-12374. Updated expunge command description.
|
HADOOP-12374. Updated expunge command description.
|
||||||
(WeiWei Yang via eyang)
|
(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
|
HADOOP-12348. MetricsSystemImpl creates MetricsSourceAdapter with wrong
|
||||||
time unit parameter. (zxu via rkanter)
|
time unit parameter. (zxu via rkanter)
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ class MetricsSourceAdapter implements DynamicMBean {
|
||||||
|
|
||||||
private void updateJmxCache() {
|
private void updateJmxCache() {
|
||||||
boolean getAllMetrics = false;
|
boolean getAllMetrics = false;
|
||||||
synchronized (this) {
|
synchronized(this) {
|
||||||
if (Time.now() - jmxCacheTS >= jmxCacheTTL) {
|
if (Time.now() - jmxCacheTS >= jmxCacheTTL) {
|
||||||
// temporarilly advance the expiry while updating the cache
|
// temporarilly advance the expiry while updating the cache
|
||||||
jmxCacheTS = Time.now() + jmxCacheTTL;
|
jmxCacheTS = Time.now() + jmxCacheTTL;
|
||||||
|
@ -169,21 +169,24 @@ class MetricsSourceAdapter implements DynamicMBean {
|
||||||
getAllMetrics = true;
|
getAllMetrics = true;
|
||||||
lastRecsCleared = false;
|
lastRecsCleared = false;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getAllMetrics) {
|
if (getAllMetrics) {
|
||||||
MetricsCollectorImpl builder = new MetricsCollectorImpl();
|
MetricsCollectorImpl builder = new MetricsCollectorImpl();
|
||||||
getMetrics(builder, true);
|
getMetrics(builder, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized(this) {
|
||||||
updateAttrCache();
|
updateAttrCache();
|
||||||
if (getAllMetrics) {
|
if (getAllMetrics) {
|
||||||
updateInfoCache();
|
updateInfoCache();
|
||||||
}
|
}
|
||||||
jmxCacheTS = Time.now();
|
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;
|
lastRecsCleared = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue