YARN-6015. AsyncDispatcher thread name can be set to improved debugging. Contributed by Ajith S.
This commit is contained in:
parent
020316458d
commit
a59df15757
|
@ -74,6 +74,11 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
|||
protected final Map<Class<? extends Enum>, EventHandler> eventDispatchers;
|
||||
private boolean exitOnDispatchException;
|
||||
|
||||
/**
|
||||
* The thread name for dispatcher.
|
||||
*/
|
||||
private String dispatcherThreadName = "AsyncDispatcher event handler";
|
||||
|
||||
public AsyncDispatcher() {
|
||||
this(new LinkedBlockingQueue<Event>());
|
||||
}
|
||||
|
@ -84,6 +89,15 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
|||
this.eventDispatchers = new HashMap<Class<? extends Enum>, EventHandler>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a name for this dispatcher thread.
|
||||
* @param dispatcherName name of the dispatcher thread
|
||||
*/
|
||||
public AsyncDispatcher(String dispatcherName) {
|
||||
this();
|
||||
dispatcherThreadName = dispatcherName;
|
||||
}
|
||||
|
||||
Runnable createThread() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
|
@ -130,7 +144,7 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
|
|||
//start all the components
|
||||
super.serviceStart();
|
||||
eventHandlingThread = new Thread(createThread());
|
||||
eventHandlingThread.setName("AsyncDispatcher event handler");
|
||||
eventHandlingThread.setName(dispatcherThreadName);
|
||||
eventHandlingThread.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ public class CommonNodeLabelsManager extends AbstractService {
|
|||
// for UT purpose
|
||||
protected void initDispatcher(Configuration conf) {
|
||||
// create async handler
|
||||
dispatcher = new AsyncDispatcher();
|
||||
dispatcher = new AsyncDispatcher("NodeLabelManager dispatcher");
|
||||
AsyncDispatcher asyncDispatcher = (AsyncDispatcher) dispatcher;
|
||||
asyncDispatcher.init(conf);
|
||||
asyncDispatcher.setDrainEventsOnStop();
|
||||
|
|
|
@ -319,7 +319,7 @@ public class NodeManager extends CompositeService
|
|||
addService(del);
|
||||
|
||||
// NodeManager level dispatcher
|
||||
this.dispatcher = new AsyncDispatcher();
|
||||
this.dispatcher = new AsyncDispatcher("NM Event dispatcher");
|
||||
|
||||
dirsHandler = new LocalDirsHandlerService(metrics);
|
||||
nodeHealthChecker =
|
||||
|
|
|
@ -223,7 +223,7 @@ public class ContainerManagerImpl extends CompositeService implements
|
|||
this.dirsHandler = dirsHandler;
|
||||
|
||||
// ContainerManager level dispatcher.
|
||||
dispatcher = new AsyncDispatcher();
|
||||
dispatcher = new AsyncDispatcher("NM ContainerManager dispatcher");
|
||||
this.deletionService = deletionContext;
|
||||
this.metrics = metrics;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class NMTimelinePublisher extends CompositeService {
|
|||
|
||||
@Override
|
||||
protected void serviceInit(Configuration conf) throws Exception {
|
||||
dispatcher = new AsyncDispatcher();
|
||||
dispatcher = new AsyncDispatcher("NM Timeline dispatcher");
|
||||
dispatcher.register(NMTimelineEventType.class,
|
||||
new ForwardingEventHandler());
|
||||
addIfService(dispatcher);
|
||||
|
|
|
@ -414,7 +414,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
|
|||
}
|
||||
|
||||
protected Dispatcher createDispatcher() {
|
||||
return new AsyncDispatcher();
|
||||
return new AsyncDispatcher("RM Event dispatcher");
|
||||
}
|
||||
|
||||
protected ResourceScheduler createScheduler() {
|
||||
|
|
|
@ -355,7 +355,7 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
}
|
||||
|
||||
protected AsyncDispatcher createDispatcher() {
|
||||
return new AsyncDispatcher();
|
||||
return new AsyncDispatcher("RM ApplicationHistory dispatcher");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public abstract class AbstractSystemMetricsPublisher extends CompositeService
|
|||
}
|
||||
|
||||
protected AsyncDispatcher createDispatcher() {
|
||||
return new AsyncDispatcher();
|
||||
return new AsyncDispatcher("RM Timeline dispatcher");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ public abstract class RMStateStore extends AbstractService {
|
|||
@Override
|
||||
protected void serviceInit(Configuration conf) throws Exception{
|
||||
// create async handler
|
||||
dispatcher = new AsyncDispatcher();
|
||||
dispatcher = new AsyncDispatcher("RM StateStore dispatcher");
|
||||
dispatcher.init(conf);
|
||||
rmStateStoreEventHandler = new ForwardingEventHandler();
|
||||
dispatcher.register(RMStateStoreEventType.class,
|
||||
|
|
Loading…
Reference in New Issue