Exemplo n.º 1
0
        /// <summary>
        /// Initialize the job (call before the manager starts).</summary>
        public void Init(JobManager manager)
        {
            this.manager = manager;

            // Hook up Scheduler_OnScheduled to all Scheduler events.
            foreach(AgentScheduler scheduler in _schedulers)
                scheduler.Scheduled += new EventHandler(Scheduler_OnScheduled);

            // Initialize job components
            foreach (JobComponent comp in JobComponents)
            {
                comp.Init(this);
                comp.Finished += new JobComponentFinishedEventHandler(Jobcomponent_OnFinished);
                comp.FinishedWithError += new JobComponentErrorEventHandler(Jobcomponent_OnFinishedWithError);
            }
        }
Exemplo n.º 2
0
        protected override void OnStart(string[] args)
        {
            try
            {
                // start the manager
                if (manager == null)
                    manager = JobManager.GetInstance();
                manager.Start();

                // for remoting
                RemoteJobManager.Manager = manager;
            }
            catch (Exception ex)
            {
                string errDescription = string.Format("{0} {1}", ex.Message, (ex.InnerException != null ? ex.InnerException.Message : ""));
                log.Error(errDescription);
            }
        }