AEMManager.AemActions.StopInstance C# (CSharp) Method

StopInstance() public static method

public static StopInstance ( AemInstance pInstance ) : void
pInstance AemInstance
return void
        public static void StopInstance(AemInstance pInstance)
        {
            string shutdownUrl = pInstance.UrlWithContextPath + "/system/console/vmstat?shutdown_type=Stop";
              if (pInstance.AemInstanceType == AemInstanceType.AEM54) {
            shutdownUrl = pInstance.UrlWithoutContextPath + "/admin/shutdown";
              }

              try {
            mLog.Debug("Execute shutdown URL: " + shutdownUrl);

            pInstance.ConsoleOutputWindow.AppendConsoleLog("Shutting down instance...");

            WebRequest request = pInstance.WebRequestCreate(shutdownUrl);
            request.Method = "POST";
            request.Timeout = 3000;

            request.GetResponse();
              }
              catch (WebException ex) {
            mLog.Debug("Unable to connect to " + shutdownUrl + ": " + ex.Message);
              }
              catch (Exception ex) {
            mLog.Error("Error executing shutdown URL: " + shutdownUrl, ex);
              }
        }

Usage Example

Example #1
0
 private void ConsoleOutputWindow_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.C && e.Control)
     {
         AemActions.StopInstance(mAemInstance);
     }
 }
All Usage Examples Of AEMManager.AemActions::StopInstance