StartProcess() public method

public StartProcess ( ) : bool
return bool
        private SIPAppServerWorker RecycleAppServer(SIPAppServerWorker badAppServerWorker, int delaySeconds, XmlNode appServerWorkerNode)
        {
            try
            {
                lock (m_recycleLock)
                {
                    // Shutdown existing worker process.
                    if (badAppServerWorker != null)
                    {
                        if (!badAppServerWorker.IsDeactivated)
                        {
                            logger.Debug("Deactivating worker on " + badAppServerWorker.AppServerEndpoint.ToString() + ".");
                            m_sipCallDispatcherFile.UpdateAppServerPriority(badAppServerWorker.AppServerEndpoint, m_unhealthyPriority);

                            lock (m_appServerWorkers)
                            {
                                m_appServerWorkers.Remove(badAppServerWorker);
                            }
                        }

                        if (delaySeconds > 0)
                        {
                            logger.Debug("Delaying process restart for " + badAppServerWorker.AppServerEndpoint.ToString() + " by " + delaySeconds + "s.");
                            Thread.Sleep(delaySeconds * 1000);
                        }

                        badAppServerWorker.Kill();
                    }

                    // Start new worker process and wait for a successful probe response before returning.
                    SIPAppServerWorker appServerWorker = new SIPAppServerWorker(appServerWorkerNode, m_sipTransport);
                    logger.Debug("Starting new worker on " + appServerWorker.AppServerEndpoint.ToString() + ".");

                    DateTime startTime = DateTime.Now;
                    if (appServerWorker.StartProcess())
                    {
                        logger.Debug("Worker on " + appServerWorker.AppServerEndpoint.ToString() + " ready after " + DateTime.Now.Subtract(startTime).TotalSeconds.ToString("0.##") + " seconds.");
                        m_sipCallDispatcherFile.UpdateAppServerPriority(appServerWorker.AppServerEndpoint, m_healthyPriority);
                        lock (m_appServerWorkers)
                        {
                            m_appServerWorkers.Add(appServerWorker);
                        }
                    }
                    else
                    {
                        logger.Debug("Worker on " + appServerWorker.AppServerEndpoint.ToString() + " failed to reach a ready state after " + DateTime.Now.Subtract(startTime).TotalSeconds.ToString("0.##") + " seconds.");
                        appServerWorker.NeedsImmediateRestart = true;
                    }

                    return(appServerWorker);
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception RecycleAppServer. " + excp.Message);
                throw;
            }
        }
        /// <summary>
        /// Starts a new SIP application server worker process.
        /// </summary>
        private void StartWorkerProcess(SIPAppServerWorker worker)
        {
            string errorMessage = worker.StartProcess();

            if (errorMessage == null)
            {
                ProbeWorker(worker, true);
            }
            else
            {
                logger.Warn("Error starting worker process for " + worker.AppServerEndpoint.ToString() + ". " + errorMessage);
            }
        }
        private SIPAppServerWorker RecycleAppServer(SIPAppServerWorker badAppServerWorker, int delaySeconds, XmlNode appServerWorkerNode)
        {
            try
            {
                lock (m_recycleLock)
                {
                    // Shutdown existing worker process.
                    if (badAppServerWorker != null)
                    {
                        if (!badAppServerWorker.IsDeactivated)
                        {
                            logger.Debug("Deactivating worker on " + badAppServerWorker.AppServerEndpoint.ToString() + ".");
                            m_sipCallDispatcherFile.UpdateAppServerPriority(badAppServerWorker.AppServerEndpoint, m_unhealthyPriority);

                            lock (m_appServerWorkers)
                            {
                                m_appServerWorkers.Remove(badAppServerWorker);
                            }
                        }

                        if (delaySeconds > 0)
                        {
                            logger.Debug("Delaying process restart for " + badAppServerWorker.AppServerEndpoint.ToString() + " by " + delaySeconds + "s.");
                            Thread.Sleep(delaySeconds * 1000);
                        }

                        badAppServerWorker.Kill();
                    }

                    // Start new worker process and wait for a successful probe response before returning.
                    SIPAppServerWorker appServerWorker = new SIPAppServerWorker(appServerWorkerNode, m_sipTransport);
                    logger.Debug("Starting new worker on " + appServerWorker.AppServerEndpoint.ToString() + ".");

                    DateTime startTime = DateTime.Now;
                    if (appServerWorker.StartProcess())
                    {
                        logger.Debug("Worker on " + appServerWorker.AppServerEndpoint.ToString() + " ready after " + DateTime.Now.Subtract(startTime).TotalSeconds.ToString("0.##") + " seconds.");
                        m_sipCallDispatcherFile.UpdateAppServerPriority(appServerWorker.AppServerEndpoint, m_healthyPriority);
                        lock (m_appServerWorkers)
                        {
                            m_appServerWorkers.Add(appServerWorker);
                        }
                    }
                    else
                    {
                        logger.Debug("Worker on " + appServerWorker.AppServerEndpoint.ToString() + " failed to reach a ready state after " + DateTime.Now.Subtract(startTime).TotalSeconds.ToString("0.##") + " seconds.");
                        appServerWorker.NeedsImmediateRestart = true;
                    }

                    return appServerWorker;
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception RecycleAppServer. " + excp.Message);
                throw;
            }
        }
 /// <summary>
 /// Starts a new SIP application server worker process.
 /// </summary>
 private void StartWorkerProcess(SIPAppServerWorker worker)
 {
     string errorMessage = worker.StartProcess();
     if (errorMessage == null)
     {
         ProbeWorker(worker, true);
     }
     else
     {
         logger.Warn("Error starting worker process for " + worker.AppServerEndpoint.ToString() + ". " + errorMessage);
     }
 }