/// <summary> /// Add event handlers for each state and assign them to methods in this class. /// </summary> /// <param name="system">BenchmarkSystem object</param> public Logger(BenchmarkSystem system) { System = system; System.Submitted += new EventHandler(OnJobSubmitted); System.Cancelled += new EventHandler(OnJobCancelled); System.Running += new EventHandler(OnJobRunning); System.Terminated += new EventHandler(OnJobTerminated); System.Failed += new EventHandler(OnJobFailed); }
static void Main(string[] args) { BenchmarkSystem system = new BenchmarkSystem(); Job job1 = new Job( p => { Console.WriteLine("Job1 is running"); return 0; }, "job1", "Michael", 4, 40 ); Job job2 = new Job( p => { Console.WriteLine("Job2 is running"); return 0; }, "job2", "Michael", 4, 5 ); Job job3 = new Job( p => { Console.WriteLine("Job3 is running"); return 0; }, "job3", "Michael", 4, 5 ); Job job4 = new Job( p => { Console.WriteLine("Job4 is running"); return 0; }, "job4", "Michael", 6, 10 ); system.Submit(job1); system.Submit(job2); system.Submit(job3); system.Submit(job4); system.Status(); system.ExecuteAll(); Console.ReadKey(); }
static void Main(string[] args) { BenchmarkSystem system = new BenchmarkSystem(); Job job1 = new Job( p => { Console.WriteLine("Job1 is running"); return(0); }, "job1", "Michael", 4, 40 ); Job job2 = new Job( p => { Console.WriteLine("Job2 is running"); return(0); }, "job2", "Michael", 4, 5 ); Job job3 = new Job( p => { Console.WriteLine("Job3 is running"); return(0); }, "job3", "Michael", 4, 5 ); Job job4 = new Job( p => { Console.WriteLine("Job4 is running"); return(0); }, "job4", "Michael", 6, 10 ); system.Submit(job1); system.Submit(job2); system.Submit(job3); system.Submit(job4); system.Status(); system.ExecuteAll(); Console.ReadKey(); }
static void Main(string[] args) { BenchmarkSystem system = new BenchmarkSystem(); Logger logger = new Logger(system); Job job1 = new Job( p => { Console.WriteLine("Job1 is running"); return 0; }, 4, 40, new Owner { name = "Michael" } ); Job job2 = new Job( p => { Console.WriteLine("Job2 is running"); return 0; }, 4, 5, new Owner { name = "Michael" } ); Job job3 = new Job( p => { Console.WriteLine("Job3 is running"); return 0; }, 4, 5, new Owner { name = "Michael" } ); Job job4 = new Job( p => { Console.WriteLine("Job4 is running"); return 0; }, 6, 10, new Owner { name = "Michael" } ); system.Submit(job1); system.Submit(job2); system.Submit(job3); system.Submit(job4); system.Status(); system.ExecuteAll(); Console.ReadKey(); }