예제 #1
0
        /// <summary>
        /// Stop the application.
        /// </summary>
        /// <param name="reason"></param>
        public void Stop(string reason)
        {
            // Since there may be a race condition around stopping the runner, check if it should be stopped
            // within a lock statement
            bool stopRunner = false;

            lock (lockObject)
            {
                if (!isStopping)
                {
                    stopRunner = true;
                    isStopping = true;
                }
            }
            if (stopRunner)
            {
                // Perform the actual stop
                Log.Info("Stopping console: " + reason);
                try
                {
                    runner.Stop();
                }
                catch (RemotingException)
                {
                    // Sometimes this exception gets thrown and not sure why.
                }
            }
        }
 private void StopAppRunner(string reason)
 {
     try
     {
         Log.Info("Stopping console: " + reason);
         runner.Stop();
     }
     catch (RemotingException)
     {
         // Sometimes this exception gets thrown and not sure why.
     }
 }