예제 #1
0
            public void Run()
            {
                string          instrName = callable.GetType().Name;
                Instrumentation instr     = this._enclosing.GetServer().Get <Instrumentation>();

                if (this._enclosing.GetServer().GetStatus() == Server.Status.Halted)
                {
                    Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.Log.Debug("Skipping [{}], server status [{}]"
                                                                                       , callable, this._enclosing.GetServer().GetStatus());
                    instr.Incr(Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.InstGroup, instrName
                               + ".skips", 1);
                }
                else
                {
                    Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.Log.Debug("Executing [{}]"
                                                                                       , callable);
                    instr.Incr(Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.InstGroup, instrName
                               + ".execs", 1);
                    Instrumentation.Cron cron = instr.CreateCron().Start();
                    try
                    {
                        callable.Call();
                    }
                    catch (Exception ex)
                    {
                        instr.Incr(Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.InstGroup, instrName
                                   + ".fails", 1);
                        Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.Log.Error("Error executing [{}], {}"
                                                                                           , new object[] { callable, ex.Message, ex });
                    }
                    finally
                    {
                        instr.AddCron(Org.Apache.Hadoop.Lib.Service.Scheduler.SchedulerService.InstGroup,
                                      instrName, cron.Stop());
                    }
                }
            }