@InterfaceAudience.Public @InterfaceStability.Evolving public class AsyncDispatcher extends org.apache.hadoop.service.AbstractService implements Dispatcher
Event
s 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.Modifier and Type | Field and Description |
---|---|
protected Map<Class<? extends Enum>,EventHandler> |
eventDispatchers |
Constructor and Description |
---|
AsyncDispatcher() |
AsyncDispatcher(BlockingQueue<Event> eventQueue) |
AsyncDispatcher(String dispatcherName)
Set a name for this dispatcher thread.
|
Modifier and Type | Method and Description |
---|---|
void |
disableExitOnDispatchException() |
protected void |
dispatch(Event event) |
EventHandler<Event> |
getEventHandler() |
protected boolean |
isDrained() |
protected boolean |
isEventThreadWaiting() |
protected boolean |
isStopped() |
void |
register(Class<? extends Enum> eventType,
EventHandler handler) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
setDrainEventsOnStop() |
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected final Map<Class<? extends Enum>,EventHandler> eventDispatchers
public AsyncDispatcher()
public AsyncDispatcher(BlockingQueue<Event> eventQueue)
public AsyncDispatcher(String dispatcherName)
dispatcherName
- name of the dispatcher threadpublic void disableExitOnDispatchException()
protected void serviceStart() throws Exception
serviceStart
in class org.apache.hadoop.service.AbstractService
Exception
public void setDrainEventsOnStop()
protected void serviceStop() throws Exception
serviceStop
in class org.apache.hadoop.service.AbstractService
Exception
protected void dispatch(Event event)
public void register(Class<? extends Enum> eventType, EventHandler handler)
register
in interface Dispatcher
public EventHandler<Event> getEventHandler()
getEventHandler
in interface Dispatcher
protected boolean isEventThreadWaiting()
protected boolean isDrained()
protected boolean isStopped()
Copyright © 2008–2019 Apache Software Foundation. All rights reserved.