コード例 #1
0
        protected internal override void Dispatch(Org.Apache.Hadoop.Yarn.Event.Event @event
                                                  )
        {
            Log.Info("Dispatching the event " + @event.GetType().FullName + "." + @event.ToString
                         ());
            Type type = @event.GetType().GetDeclaringClass();

            if (eventDispatchers[type] != null)
            {
                eventDispatchers[type].Handle(@event);
            }
        }
コード例 #2
0
        protected internal virtual void Dispatch(Org.Apache.Hadoop.Yarn.Event.Event @event
                                                 )
        {
            //all events go thru this loop
            if (Log.IsDebugEnabled())
            {
                Log.Debug("Dispatching the event " + @event.GetType().FullName + "." + @event.ToString
                              ());
            }
            Type type = @event.GetType().GetDeclaringClass();

            try
            {
                EventHandler handler = eventDispatchers[type];
                if (handler != null)
                {
                    handler.Handle(@event);
                }
                else
                {
                    throw new Exception("No handler for registered for " + type);
                }
            }
            catch (Exception t)
            {
                //TODO Maybe log the state of the queue
                Log.Fatal("Error in dispatcher thread", t);
                // If serviceStop is called, we should exit this thread gracefully.
                if (exitOnDispatchException && (ShutdownHookManager.Get().IsShutdownInProgress())
                    == false && stopped == false)
                {
                    Sharpen.Thread shutDownThread = new Sharpen.Thread(CreateShutDownThread());
                    shutDownThread.SetName("AsyncDispatcher ShutDown handler");
                    shutDownThread.Start();
                }
            }
        }