diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SchedulerMetrics.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SchedulerMetrics.java index b8bc8be431..2957d239f1 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SchedulerMetrics.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SchedulerMetrics.java @@ -32,7 +32,6 @@ import java.util.SortedMap; import java.util.Locale; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.Lock; @@ -48,6 +47,7 @@ import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ReflectionUtils; +import org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler; @@ -169,7 +169,7 @@ void init(ResourceScheduler resourceScheduler, Configuration config) web.start(); // a thread to update histogram timer - pool = new ScheduledThreadPoolExecutor(2); + pool = new HadoopScheduledThreadPoolExecutor(2); pool.scheduleAtFixedRate(new HistogramsRunnable(), 0, 1000, TimeUnit.MILLISECONDS); @@ -518,7 +518,8 @@ class MetricsLogRunnable implements Runnable { @Override public void run() { - if(running) { + SchedulerWrapper wrapper = (SchedulerWrapper) scheduler; + if(running && wrapper.getTracker().getQueueSet() != null) { // all WebApp to get real tracking json String trackingMetrics = web.generateRealTimeTrackingMetrics(); // output