Exemple #1
0
        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();
        }
Exemple #2
0
        public static void f_handle_Test()
        {
            IJobContext jc     = new JobMonitor();
            IJob        jo     = new JobTest(jc);
            IJobHandle  handle = new JobHandle(jo);

            Console.WriteLine("Enter to stop all JOB...");
            Console.ReadLine();
            handle.f_actionJob(JOB_HANDLE.REMOVE);

            Console.WriteLine("Enter to exit...");
            Console.ReadLine();
        }
Exemple #3
0
        public static void f_websocket_Handle()
        {
            IJobContext jc = new JobMonitor();

            IJob       ws       = new JobWebSocketServerTest(jc);
            IJobHandle handleWS = new JobHandle(ws);

            Console.WriteLine("Enter to create WS Client ... ");
            Console.ReadLine();

            IJob       client       = new JobWebSocketClientTest(jc);
            IJobHandle handleClient = new JobHandle(client);

            Console.WriteLine("Enter to stop all JOB...");
            Console.ReadLine();

            handleClient.f_actionJob(JOB_HANDLE.REMOVE);
            handleWS.f_actionJob(JOB_HANDLE.REMOVE);
            jc.f_removeAll();

            Console.WriteLine("Enter to exit...");
            Console.ReadLine();
        }
Exemple #4
0
        public static void f_rpc_Handle()
        {
            IJobContext jc = new JobMonitor();

            IJob       server       = new JobRpcServerTest(jc);
            IJobHandle handleServer = new JobHandle(server);

            Console.WriteLine("Enter to create client ... ");
            Console.ReadLine();

            IJob       client       = new JobRpcClientTest(jc);
            IJobHandle handleClient = new JobHandle(client);

            Console.WriteLine("Enter to stop all JOB...");
            Console.ReadLine();

            handleClient.f_actionJob(JOB_HANDLE.REMOVE);
            handleServer.f_actionJob(JOB_HANDLE.REMOVE);
            jc.f_removeAll();

            Console.WriteLine("Enter to exit...");
            Console.ReadLine();
        }