Exemplo n.º 1
0
        void RestartHelper(bool restart)
        {
            if (restart)
            {
                try
                {
                    MsdtcWrapper msdtc = this.GetMsdtcWrapper();
                    msdtc.RestartDtcService();
                }
                catch (WsatAdminException)
                {
                    throw;
                }
#pragma warning suppress 56500
                catch (Exception e)
                {
                    if (Utilities.IsCriticalException(e))
                    {
                        throw;
                    }
                    throw new WsatAdminException(WsatAdminErrorCode.DTC_RESTART_ERROR, SR.GetString(SR.ErrorRestartMSDTC), e);
                }
            }
        }
Exemplo n.º 2
0
        // Execute the user's command
        void Run()
        {
            switch (operation)
            {
            case Operations.Change:
                newConfig.ValidateThrow();
                if (restartRequired)
                {
                    Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC));
                }
                newConfig.Save(restartRequired);
                if (restartRequired)
                {
                    Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC));
                }
                if (newConfig.IsClustered)
                {
                    Console.WriteLine(SR.GetString(SR.ClusterConfigUpdatedSuccessfully));
                }
                else
                {
                    Console.WriteLine(SR.GetString(SR.ConfigUpdatedSuccessfully));
                }
                break;

            case Operations.None:
                // does nothing
                break;

            case Operations.Help:
            // fall through
            default:
                PrintUsage();
                break;
            }

            if (operation != Operations.Change && restartRequired)
            {
                try
                {
                    MsdtcWrapper msdtc = newConfig.GetMsdtcWrapper();
                    Console.WriteLine(SR.GetString(SR.InfoRestartingMSDTC));
                    msdtc.RestartDtcService();
                    Console.WriteLine(SR.GetString(SR.InfoRestartedMSDTC));
                }
                catch (WsatAdminException)
                {
                    throw;
                }
#pragma warning suppress 56500
                catch (Exception e)
                {
                    if (Utilities.IsCriticalException(e))
                    {
                        throw;
                    }
                    throw new WsatAdminException(WsatAdminErrorCode.DTC_RESTART_ERROR, SR.GetString(SR.ErrorRestartMSDTC), e);
                }
            }

            if (this.showRequired)
            {
                Console.WriteLine();
                Console.WriteLine(SR.GetString(SR.ConsoleShowInformation));
                Console.WriteLine(operation == Operations.Change ? this.newConfig.ToString() : this.previousConfig.ToString());
            }
        }