Package org.apache.hadoop.yarn.event
Class EventDispatcher<T extends Event>
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.event.EventDispatcher<T>
- Type Parameters:
T- Type of Event
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,EventHandler<T>
public class EventDispatcher<T extends Event>
extends org.apache.hadoop.service.AbstractService
implements EventHandler<T>
This is a specialized EventHandler to be used by Services that are expected
handle a large number of events efficiently by ensuring that the caller
thread is not blocked. Events are immediately stored in a BlockingQueue and
a separate dedicated Thread consumes events from the queue and handles
appropriately
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected longintvoidprotected booleanprotected voidprotected voidvoidsetMetrics(EventTypeMetrics metrics) Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
EventDispatcher
-
-
Method Details
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
handle
- Specified by:
handlein interfaceEventHandler<T extends Event>
-
disableExitOnError
@VisibleForTesting public void disableExitOnError() -
setMetrics
-
getEventProcessorId
protected long getEventProcessorId() -
isStopped
protected boolean isStopped() -
getEventQueueSize
public int getEventQueueSize()
-