HADOOP-11361. Fix a race condition in MetricsSourceAdapter.updateJmxCache. Contributed by Brahma Reddy Battula.
This commit is contained in:
parent
0e85044e26
commit
4356e8a5ef
@ -674,6 +674,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
HADOOP-11962. Sasl message with MD5 challenge text shouldn't be LOG out
|
HADOOP-11962. Sasl message with MD5 challenge text shouldn't be LOG out
|
||||||
even in debug level. (Junping Du via wheat9)
|
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
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -154,31 +154,28 @@ public MBeanInfo getMBeanInfo() {
|
|||||||
|
|
||||||
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;
|
||||||
if (lastRecs == null) {
|
if (lastRecs == null) {
|
||||||
getAllMetrics = true;
|
getAllMetrics = true;
|
||||||
}
|
}
|
||||||
}
|
} 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user