//public static IFORM get_Main() { // return null; //} static void f_Exit() { jom.f_removeAll(); if (Xpcom.IsInitialized) { Xpcom.Shutdown(); } Application.ExitThread(); GC.Collect(); GC.WaitForPendingFinalizers(); Application.Exit(); }
public static void f_jobTest_Factory() { IJobContext jc = new JobMonitor(); jc.f_createNew(new JobTest(jc)); jc.f_createNew(new JobTest(jc)); jc.f_createNew(new JobTest(jc)); jc.f_createNew(new JobTest(jc)); jc.f_createNew(new JobTest(jc)); ///////////////////////////////////////////////////// Console.WriteLine("Enter to send many request to load balancer jobs on factory ..."); Console.ReadLine(); const int len = 9; Message[] ms = new Message[len]; for (int i = 0; i < len; i++) { ms[i] = new Message() { Input = i }; if (i == 0) { ms[i].f_setTimeOut(30000); } if (i == 5) { ms[i].f_setTimeOut(7000); } if (i == 8) { ms[i].f_setTimeOut(5000); } } Func <IJobHandle, Guid, bool> responseCallbackDoneAll = (msgHandle, groupId) => { System.Tracer.WriteLine("TEST_JOB.RUN_TEST(): FINISH ...."); return(false); }; jc.f_sendRequestMessages(JOB_TYPE.NONE, ms, responseCallbackDoneAll); ///////////////////////////////////////////////////// //jobs.OnStopAll += (se, ev) => { // Tracer.WriteLine(">>>>> STOP ALL JOBS: DONE ..."); //}; //while (true) //{ // Console.WriteLine("Enter to stop all..."); // Console.ReadLine(); // jobs.f_job_stopAll(); // Console.WriteLine("Enter to restart all..."); // Console.ReadLine(); // jobs.f_restartAllJob(); //} ///////////////////////////////////////////////////// Console.WriteLine("Enter to stop all JOB..."); Console.ReadLine(); jc.f_removeAll(); ///////////////////////////////////////////////////// Console.WriteLine("Enter to exit..."); Console.ReadLine(); }