Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }