private int StopRetryInterval = 1000 * 30; // 30 seconds
        public void SendStop()
        {
            this.Status = AzurePluginStatus.Stopping;

            Trace.TraceAndLogWarning("HybrisPlugin", "SendStop: Kill hybris child processes.");
            foreach (var childProcess in _HybrisJavaProcess.GetChildProcesses(true).Reverse())
            {
                try
                {
                    childProcess.Kill();
                }
                catch (Exception ex)
                {
                    Trace.TraceWarning("HybrisPlugin: SendStop: Could not kill process with ID=" + childProcess.Id.ToString() + ": " + ex.ToString());
                }
            }
            try
            {
                _HybrisJavaProcess.Kill();
            }
            catch (Exception ex)
            {
                Trace.TraceWarning("HybrisPlugin: SendStop: Could not kill HybrisJavaProcess: " + ex.ToString());
            }

            if (!_HybrisJavaProcess.HasExited)
            {
                this.Status = AzurePluginStatus.Unknown;
            }
            else
            {
                this.Status = AzurePluginStatus.Stopped;
            }
            this.StatusMessage = "Stopped.";

            if (this.ConfigStopHybris)
            {
                this.StatusMessage = "Stopped due to additional configuration change.";
            }
            else
            {
                this.StatusMessage = "Stopped.";
            }
        }
        private int StopRetryInterval = 1000 * 30; // 30 seconds
        public void SendStop()
        {
            this.Status = AzurePluginStatus.Stopping;

            // ADAPTING: Kill the Solr process
            Trace.TraceAndLogWarning("SolrPlugin", "SendStop: Kill solr child processes.");
            foreach (var childProcess in _SolrJavaProcess.GetChildProcesses(true).Reverse())
            {
                try
                {
                    childProcess.Kill();
                }
                catch (Exception ex)
                {
                    Trace.TraceWarning("SolrPlugin: SendStop: Could not kill process with ID=" + childProcess.Id.ToString() + ": " + ex.ToString());
                }
            }
            try
            {
                Trace.TraceInformation("SolrPlugin: SendStop: Stopping SolrJavaProcess.");
                _SolrJavaProcess.Kill();
                Trace.TraceAndLogInformation("SolrPlugin", "SendStop: SolrJavaProcess killed.");
            }
            catch (Exception ex)
            {
                Trace.TraceAndLogError("SolrPlugin", "SendStop: Could not kill SolrJavaProcess. " + ex.ToString());
            }

            if (!_SolrJavaProcess.HasExited)
            {
                this.Status = AzurePluginStatus.Unknown;
            }
            else
            {
                this.Status = AzurePluginStatus.Stopped;
            }


            if (this.ConfigStopSolr)
            {
                this.StatusMessage = "Stopped due to additional configuration change.";
            }
            else
            {
                this.StatusMessage = "Stopped.";
            }

            return;

            #region skipped
            //for (int i = 1; i <= this.StopRetries; i++)
            //{
            //    if (this.IsAlive)
            //    {
            //        // Prepare SOLR stop
            //        string solrWorkingDirectory = Path.Combine(BaseDirectory, "solr", "server");
            //        string solrStopCommandFileName = Path.Combine(solrWorkingDirectory, "solr-stop.cmd");

            //        System.Diagnostics.Process stopProcess = null;

            //        try
            //        {
            //            stopProcess = new System.Diagnostics.Process
            //            {
            //                StartInfo = new System.Diagnostics.ProcessStartInfo
            //                {
            //                    WorkingDirectory = solrWorkingDirectory,
            //                    FileName = solrStopCommandFileName,
            //                    Arguments = string.Empty,
            //                    UseShellExecute = false,
            //                    RedirectStandardOutput = true,
            //                    RedirectStandardError = true,
            //                    CreateNoWindow = true,
            //                    WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
            //                }
            //            };
            //            stopProcess.OutputDataReceived += (s, a) => { if (!string.IsNullOrWhiteSpace(a.Data)) Trace.TraceVerbose("SolrPlugin: SendStop: Solr stop process output: " + a.Data); };
            //            stopProcess.ErrorDataReceived += (s, a) => { if (!string.IsNullOrWhiteSpace(a.Data)) Trace.TraceAndLogError("SolrPlugin", "SendStop: Solr stop process error: " + a.Data); };
            //            stopProcess.Exited += (s, a) => Trace.TraceInformation("SolrPlugin: SendStop: Solr stop process exited.");
            //            if (stopProcess.Start())
            //            {
            //                stopProcess.BeginOutputReadLine();
            //                stopProcess.BeginErrorReadLine();
            //            }

            //            // Wait up to XX minutes for solr process to exit
            //            Trace.TraceInformation(string.Format("SolrPlugin: SendStop: Waiting up to {0} minutes for solr process to exit.", JavaProcessShutdownWaitMinutes));
            //            if (!stopProcess.WaitForExit((int)TimeSpan.FromMinutes(JavaProcessShutdownWaitMinutes).TotalMilliseconds))
            //            {
            //                // the process did not exit after XX minutes
            //                // > force the process to exit
            //                Trace.TraceAndLogWarning("SolrPlugin", "SendStop: Kill solr platform process.");
            //                foreach (var childProcess in _SolrJavaProcess.GetChildProcesses(true).Reverse())
            //                {
            //                    try
            //                    {
            //                        childProcess.Kill();
            //                    }
            //                    catch (Exception ex)
            //                    {
            //                        Trace.TraceWarning("SolrPlugin: SendStop: Could not kill process with ID=" + childProcess.Id.ToString() + ": " + ex.ToString());
            //                    }
            //                }
            //                try
            //                {
            //                    _SolrJavaProcess.Kill();
            //                }
            //                catch (Exception ex)
            //                {
            //                    Trace.TraceWarning("SolrPlugin: SendStop: Could not kill SolrJavaProcess: " + ex.ToString());
            //                }
            //                try
            //                {
            //                    stopProcess.Kill();
            //                }
            //                catch (Exception ex)
            //                {
            //                    Trace.TraceWarning("SolrPlugin: SendStop: Could not kill stopProcess: " + ex.ToString());
            //                }
            //            }

            //            if (!stopProcess.HasExited)
            //            {
            //                Trace.TraceWarning("SolrPlugin: SendStop: StopProcess has not exited > kill it.");
            //                try
            //                {
            //                    stopProcess.Kill();
            //                }
            //                catch(Exception ex)
            //                {
            //                    Trace.TraceAndLogError("SolrPlugin", "SendStop: In retry " + i.ToString() + "Stop process did not exit and could not be killed. Exception: " + ex.ToString());
            //                }
            //            }
            //            if (_SolrJavaProcess.HasExited)
            //            {
            //                Trace.TraceInformation("SolrPlugin: SendStop: SolrJavaProcess exited.");
            //                if (!this.ConfigStopSolr)
            //                {
            //                    // we have not been shut down not due to an additional configuration change
            //                    this.Status = AzurePluginStatus.Stopped;
            //                    this.StatusMessage = string.Empty;
            //                }

            //                break;
            //            }
            //            else if (i == this.StopRetries)
            //            {
            //                Trace.TraceAndLogError("SolrPlugin", "SendStop: Final retry " + i.ToString() + ": SolrJavaProcess did not exit. Killing it.");
            //                try
            //                {
            //                    _SolrJavaProcess.Kill();
            //                    if (!this.ConfigStopSolr)
            //                    {
            //                        // we have not been shut down not due to an additional configuration change
            //                        this.Status = AzurePluginStatus.Stopped;
            //                        this.StatusMessage = string.Empty;
            //                    }
            //                }
            //                catch(Exception ex)
            //                {
            //                    Trace.TraceAndLogError("SolrPlugin", "SendStop: Final retry " + i.ToString() + ": Could not kill SolrJavaProcess.  Exception: " + ex.ToString());
            //                    this.Status = AzurePluginStatus.Error;
            //                    this.StatusMessage = "Could not kill Solr Process after final stop retry.";
            //                }
            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            Trace.TraceAndLogError("SolrPlugin", "Error stopping Solr Plugin: " + ex.ToString());
            //            this.Status = AzurePluginStatus.Unknown;
            //            this.StatusMessage = "Error stopping SolrPlugin";
            //        }
            //        System.Threading.Thread.Sleep(this.StopRetryInterval);
            //    }
            //}
            #endregion
        }