diff --git hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java index 707dc4c..d89faac 100644 --- hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java +++ hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/impl/JmxCacheBuster.java @@ -51,10 +51,14 @@ public class JmxCacheBuster { */ public static void clearJmxCache() { - //If there are more then 100 ms before the executor will run then everything should be merged. - if (fut == null || (!fut.isDone() && fut.getDelay(TimeUnit.MILLISECONDS) > 100)) return; - + // If there are more then 100 ms before the executor will run then everything should be merged. + if (fut != null && !fut.isDone() && fut.getDelay(TimeUnit.MILLISECONDS) > 100) { + return; + } synchronized (lock) { + if (fut != null && !fut.isDone() && fut.getDelay(TimeUnit.MILLISECONDS) > 100) { + return; + } fut = executor.getExecutor().schedule(new JmxCacheBusterRunnable(), 5, TimeUnit.SECONDS); } }