org.apache.hadoop.yarn.event
Class AsyncDispatcher

java.lang.Object
  extended by org.apache.hadoop.yarn.service.AbstractService
      extended by org.apache.hadoop.yarn.event.AsyncDispatcher
All Implemented Interfaces:
Dispatcher, Service

public class AsyncDispatcher
extends 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.yarn.service.Service
Service.STATE
 
Field Summary
protected  Map<Class<? extends Enum>,EventHandler> eventDispatchers
           
 
Fields inherited from interface org.apache.hadoop.yarn.event.Dispatcher
DEFAULT_DISPATCHER_EXIT_ON_ERROR, DISPATCHER_EXIT_ON_ERROR_KEY
 
Constructor Summary
AsyncDispatcher()
           
AsyncDispatcher(BlockingQueue<Event> eventQueue)
           
 
Method Summary
protected  void dispatch(Event event)
           
 EventHandler getEventHandler()
           
 void init(org.apache.hadoop.conf.Configuration conf)
          Initialize the service.
 void register(Class<? extends Enum> eventType, EventHandler handler)
           
 void start()
          Start the service.
 void stop()
          Stop the service.
 
Methods inherited from class org.apache.hadoop.yarn.service.AbstractService
getConfig, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventDispatchers

protected final Map<Class<? extends Enum>,EventHandler> eventDispatchers
Constructor Detail

AsyncDispatcher

public AsyncDispatcher()

AsyncDispatcher

public AsyncDispatcher(BlockingQueue<Event> eventQueue)
Method Detail

init

public void init(org.apache.hadoop.conf.Configuration conf)
Description copied from class: AbstractService
Initialize the service. The transition must be from Service.STATE.NOTINITED to Service.STATE.INITED unless the operation failed and an exception was raised.

Specified by:
init in interface Service
Overrides:
init in class AbstractService
Parameters:
conf - the configuration of the service

start

public void start()
Description copied from class: AbstractService
Start the service. The transition should be from Service.STATE.INITED to Service.STATE.STARTED unless the operation failed and an exception was raised.

Specified by:
start in interface Service
Overrides:
start in class AbstractService

stop

public void stop()
Description copied from class: AbstractService
Stop the service. This operation must be designed to complete regardless of the initial state of the service, including the state of all its internal fields.

Specified by:
stop in interface Service
Overrides:
stop in class AbstractService

dispatch

protected void dispatch(Event event)

register

public void register(Class<? extends Enum> eventType,
                     EventHandler handler)
Specified by:
register in interface Dispatcher

getEventHandler

public EventHandler getEventHandler()
Specified by:
getEventHandler in interface Dispatcher


Copyright © 2012 Apache Software Foundation. All Rights Reserved.