java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.service.Service, Dispatcher@Public @Evolving public class AsyncDispatcher extends org.apache.hadoop.service.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.| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.Map<java.lang.Class<? extends java.lang.Enum>,EventHandler> |
eventDispatchers |
| Constructor | Description |
|---|---|
AsyncDispatcher() |
|
AsyncDispatcher(java.lang.String dispatcherName) |
Set a name for this dispatcher thread.
|
AsyncDispatcher(java.util.concurrent.BlockingQueue<Event> eventQueue) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addMetrics(EventTypeMetrics metrics,
java.lang.Class<? extends java.lang.Enum> eventClass) |
|
void |
disableExitOnDispatchException() |
|
protected void |
dispatch(Event event) |
|
EventHandler<Event> |
getEventHandler() |
|
int |
getEventQueueSize() |
|
protected boolean |
isDrained() |
|
protected boolean |
isEventThreadWaiting() |
|
protected boolean |
isStopped() |
|
void |
register(java.lang.Class<? extends java.lang.Enum> eventType,
EventHandler handler) |
|
protected void |
serviceInit(org.apache.hadoop.conf.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 java.util.Map<java.lang.Class<? extends java.lang.Enum>,EventHandler> eventDispatchers
public AsyncDispatcher()
public AsyncDispatcher(java.util.concurrent.BlockingQueue<Event> eventQueue)
public AsyncDispatcher(java.lang.String dispatcherName)
dispatcherName - name of the dispatcher thread@VisibleForTesting public void disableExitOnDispatchException()
protected void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws java.lang.Exception
serviceInit in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionprotected void serviceStart()
throws java.lang.Exception
serviceStart in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionpublic void setDrainEventsOnStop()
protected void serviceStop()
throws java.lang.Exception
serviceStop in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionprotected void dispatch(Event event)
public void register(java.lang.Class<? extends java.lang.Enum> eventType,
EventHandler handler)
register in interface Dispatcherpublic EventHandler<Event> getEventHandler()
getEventHandler in interface Dispatcher@VisibleForTesting protected boolean isEventThreadWaiting()
protected boolean isDrained()
protected boolean isStopped()
public void addMetrics(EventTypeMetrics metrics, java.lang.Class<? extends java.lang.Enum> eventClass)
public int getEventQueueSize()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.