Package org.apache.hadoop.yarn.event
Class AsyncDispatcher
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.event.AsyncDispatcher
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,Dispatcher
@Public
@Evolving
public class AsyncDispatcher
extends org.apache.hadoop.service.AbstractService
implements Dispatcher
Dispatches
Events in a separate thread. Currently only single thread
does that. Potentially there could be multiple channels for each event type
class and a thread pool can be used to dispatch the events.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Class<? extends Enum>,EventHandler> protected static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionAsyncDispatcher(String dispatcherName) Set a name for this dispatcher thread.AsyncDispatcher(BlockingQueue<Event> eventQueue) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetrics(EventTypeMetrics metrics, Class<? extends Enum> eventClass) voidprotected voidintprotected booleanprotected booleanprotected booleanprotected voidlogTriggered(String message) voidregister(Class<? extends Enum> eventType, EventHandler handler) protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidvoidMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
eventDispatchers
-
-
Constructor Details
-
AsyncDispatcher
public AsyncDispatcher() -
AsyncDispatcher
-
AsyncDispatcher
Set a name for this dispatcher thread.- Parameters:
dispatcherName- name of the dispatcher thread
-
-
Method Details
-
logTriggered
-
disableExitOnDispatchException
@VisibleForTesting public void disableExitOnDispatchException() -
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
setDrainEventsOnStop
public void setDrainEventsOnStop() -
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
dispatch
-
register
- Specified by:
registerin interfaceDispatcher
-
getEventHandler
- Specified by:
getEventHandlerin interfaceDispatcher
-
isEventThreadWaiting
@VisibleForTesting protected boolean isEventThreadWaiting() -
isDrained
protected boolean isDrained() -
isStopped
protected boolean isStopped() -
addMetrics
-
getEventQueueSize
public int getEventQueueSize()
-