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

This reverts commit 4356e8a5ef.

Conflicts:

	hadoop-common-project/hadoop-common/CHANGES.txt
	hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
This commit is contained in:
Jason Lowe 2015-11-24 19:12:04 +00:00
parent 0e1c12c174
commit 17b1a5482b
2 changed files with 10 additions and 10 deletions

View File

@ -1492,9 +1492,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)

View File

@ -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;
}
}