コード例 #1
0
ファイル: ProcessFactory.cs プロジェクト: zhonli/Yams
        public IProcess CreateProcess(AppIdentity identity, string exePath, bool monitorInitialization, bool monitorHealth,
                                      bool gracefulShutdown)
        {
            IProcess process = new Process(identity, exePath, _config.UseShellExecute, system);

            if (monitorInitialization)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new MonitorInitProcessDecorator(identity, _config, process,
                                                          new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            if (gracefulShutdown)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new GracefulShutdownProcessDecorator(identity, _config, process,
                                                               new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            if (monitorHealth)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new HealthProcessDecorator(identity, _config, process,
                                                     new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            return(new SelfRestartingProcess(process, _config.ApplicationRestartCount));
        }
コード例 #2
0
ファイル: ProcessFactory.cs プロジェクト: youscan/Yams
        public IProcess CreateProcess(string exePath, bool monitorInitialization, bool monitorHealth,
                                      bool gracefulShutdown)
        {
            IProcess process = new Process(exePath, _config.ShowApplicationProcessWindow);

            if (gracefulShutdown)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new GracefulShutdownProcessDecorator(_config, process,
                                                               new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            if (monitorHealth)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new HealthProcessDecorator(_config, process,
                                                     new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            if (monitorInitialization)
            {
                string pipeName = Guid.NewGuid().ToString();
                process = new MonitorInitProcessDecorator(_config, process,
                                                          new IpcConnection(new NamedPipeServerAdapter(pipeName)));
            }
            return(new SelfRestartingProcess(process, _config.ApplicationRestartCount));
        }