@InterfaceAudience.Public @InterfaceStability.Evolving public class AsyncDispatcher extends AbstractService implements Dispatcher
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.Service.STATE| Modifier and Type | Field and Description |
|---|---|
protected Map<Class<? extends Enum>,EventHandler> |
eventDispatchers |
DEFAULT_DISPATCHER_EXIT_ON_ERROR, DISPATCHER_EXIT_ON_ERROR_KEY| Constructor and Description |
|---|
AsyncDispatcher() |
AsyncDispatcher(BlockingQueue<Event> eventQueue) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
dispatch(Event event) |
EventHandler |
getEventHandler() |
protected boolean |
isDrained() |
protected boolean |
isEventThreadWaiting() |
void |
register(Class<? extends Enum> eventType,
EventHandler handler) |
protected void |
serviceInit(Configuration conf) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
setDrainEventsOnStop() |
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected final Map<Class<? extends Enum>,EventHandler> eventDispatchers
public AsyncDispatcher()
public AsyncDispatcher(BlockingQueue<Event> eventQueue)
protected void serviceInit(Configuration conf) throws Exception
serviceInit in class AbstractServiceExceptionprotected void serviceStart()
throws Exception
serviceStart in class AbstractServiceExceptionpublic void setDrainEventsOnStop()
protected void serviceStop()
throws Exception
serviceStop in class AbstractServiceExceptionprotected void dispatch(Event event)
public void register(Class<? extends Enum> eventType, EventHandler handler)
register in interface Dispatcherpublic EventHandler getEventHandler()
getEventHandler in interface Dispatcherprotected boolean isEventThreadWaiting()
protected boolean isDrained()
Copyright © 2018 CERN. All Rights Reserved.