|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
|
|
|
|
|
|
|
+import org.apache.hadoop.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
|
|
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
|
|
import com.sun.jersey.spi.container.servlet.ServletContainer;
|
|
import com.sun.jersey.spi.container.servlet.ServletContainer;
|
|
|
|
|
|
@@ -152,6 +153,8 @@ import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -715,6 +718,7 @@ public class ResourceManager extends CompositeService
|
|
private boolean fromActive = false;
|
|
private boolean fromActive = false;
|
|
private StandByTransitionRunnable standByTransitionRunnable;
|
|
private StandByTransitionRunnable standByTransitionRunnable;
|
|
private RMNMInfo rmnmInfo;
|
|
private RMNMInfo rmnmInfo;
|
|
|
|
+ private ScheduledThreadPoolExecutor eventQueueMetricExecutor;
|
|
|
|
|
|
RMActiveServices(ResourceManager rm) {
|
|
RMActiveServices(ResourceManager rm) {
|
|
super("RMActiveServices");
|
|
super("RMActiveServices");
|
|
@@ -937,6 +941,23 @@ public class ResourceManager extends CompositeService
|
|
addIfService(volumeManager);
|
|
addIfService(volumeManager);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ eventQueueMetricExecutor = new ScheduledThreadPoolExecutor(1,
|
|
|
|
+ new ThreadFactoryBuilder().
|
|
|
|
+ setDaemon(true).setNameFormat("EventQueueSizeMetricThread").
|
|
|
|
+ build());
|
|
|
|
+ eventQueueMetricExecutor.scheduleAtFixedRate(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ int rmEventQueueSize = ((AsyncDispatcher)getRMContext().
|
|
|
|
+ getDispatcher()).getEventQueueSize();
|
|
|
|
+ ClusterMetrics.getMetrics().setRmEventQueueSize(rmEventQueueSize);
|
|
|
|
+ int schedulerEventQueueSize = ((EventDispatcher)schedulerDispatcher).
|
|
|
|
+ getEventQueueSize();
|
|
|
|
+ ClusterMetrics.getMetrics().
|
|
|
|
+ setSchedulerEventQueueSize(schedulerEventQueueSize);
|
|
|
|
+ }
|
|
|
|
+ }, 1, 1, TimeUnit.SECONDS);
|
|
|
|
+
|
|
super.serviceInit(conf);
|
|
super.serviceInit(conf);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1012,6 +1033,9 @@ public class ResourceManager extends CompositeService
|
|
LOG.error("Error closing store.", e);
|
|
LOG.error("Error closing store.", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (eventQueueMetricExecutor != null) {
|
|
|
|
+ eventQueueMetricExecutor.shutdownNow();
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|