/// <summary>Terminate the current process.</summary> /// <remarks> /// Terminate the current process. Note that terminate is the *only* method /// that should be used to terminate the daemon processes. /// </remarks> /// <param name="status">exit code</param> /// <param name="msg"> /// message used to create the /// <c>ExitException</c> /// </param> /// <exception cref="ExitException">if System.exit is disabled for test purposes</exception> /// <exception cref="Org.Apache.Hadoop.Util.ExitUtil.ExitException"/> public static void Terminate(int status, string msg) { Log.Info("Exiting with status " + status); if (systemExitDisabled) { ExitUtil.ExitException ee = new ExitUtil.ExitException(status, msg); Log.Fatal("Terminate called", ee); if (null == firstExitException) { firstExitException = ee; } throw ee; } System.Environment.Exit(status); }
/// <summary>Reset the tracking of process termination.</summary> /// <remarks> /// Reset the tracking of process termination. This is for use in unit tests /// where one test in the suite expects an exit but others do not. /// </remarks> public static void ResetFirstExitException() { firstExitException = null; }