コード例 #1
0
 public static OutOfProcessReportGenerationController CreateController(
     IOutOfProcessConfiguration configuration,
     IProcessFactory processFactory,
     IReportQueueStatusService statusService)
 {
     var controller = new OutOfProcessReportGenerationController(configuration, processFactory,
         statusService);
     controller.RunProcess = true;
     controller.DatabaseQueuePollInterval = 500;
     return controller;
 }
コード例 #2
0
        /// <summary>
        /// The OnStart Event
        /// </summary>
        /// <param name="args">The arguments</param>
        protected override void OnStart(string[] args)
        {
            try
            {
                // Report Generation Controlle
                this._ReportGenerationController = OutOfProcessControllerFactory.Create();

                this._ReportGenerationController.RunProcess = true;
                this._ReportGenerationControllerThread = new System.Threading.Thread(this._ReportGenerationController.Run);
                this._ReportGenerationControllerThread.Start();
            }
            catch (Exception exception)
            {
                AdaptableErrorHandler.AdaptableErrorHandlerInstance.HandleError("Application", "GRP.MainController", exception);
            }
        }
コード例 #3
0
ファイル: ServiceTest.cs プロジェクト: rsdgjb/GRP_PERFICIENT
        public void TestMethod1()
        {
            Thread _ReportGeneratorThread = null;

            OutOfProcessReportGenerationController _ReportGenerator = null;

            //TimeLine
            _ReportGenerator = new OutOfProcessReportGenerationController(this.ErrorHandler);
            _ReportGenerator.RunProcess = true;
            _ReportGeneratorThread = new System.Threading.Thread(_ReportGenerator.Run);
            _ReportGeneratorThread.Start();

            while (_ReportGeneratorThread.ThreadState == ThreadState.Running ||
                _ReportGeneratorThread.ThreadState == ThreadState.WaitSleepJoin)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
コード例 #4
0
        public static void MonitorController(OutOfProcessReportGenerationController controller, int monitorQueueId)
        {
            controller.RunProcess = true;
            IHostedProcess runningProcess = null;

            ProcessStartedEvent handler = (sender, args) =>
            {
                if (args.Process.ReportGenerationQueueId == monitorQueueId)
                {
                    runningProcess = args.Process;
                }
            };

            controller.OnProcessStarted += handler;

            var lastTick = DateTime.Now.Ticks;
            Thread monitor = new Thread(new ThreadStart(() =>
            {
                try
                {
                    while (runningProcess == null || !runningProcess.HasExited)
                    {
                        TimeOutHelper.TimeOutCheck(lastTick, 60);
                        Thread.Sleep(10);
                    }
                    controller.RunProcess = false;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Fatal thread exception: " + e.Message);
                }
            }));
            monitor.Start();

            controller.Run();

            controller.OnProcessStarted -= handler;
        }