| | |
| | | WebResponseContent result = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (_scheduler.IsShutdown && _scheduler.IsStarted) |
| | | if (_scheduler.IsShutdown || !_scheduler.IsStarted) |
| | | { |
| | | // 从Factory中获取Scheduler实例 |
| | | NameValueCollection collection = new NameValueCollection |
| | |
| | | } |
| | | else |
| | | { |
| | | await _scheduler.Shutdown(); |
| | | // 调度器已在运行,直接返回提示 |
| | | result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStart); |
| | | return result; |
| | | } |
| | |
| | | //等待任务运行完成 |
| | | await _scheduler.Shutdown(false); |
| | | |
| | | await Console.Out.WriteLineAsync(QuartzJobInfoMessage.StopJobSuccess); |
| | | QuartzLogger.Info(QuartzJobInfoMessage.StopJobSuccess); |
| | | result = WebResponseContent.Instance.OK(QuartzJobInfoMessage.StopJobSuccess); |
| | | return result; |
| | | } |
| | | else |
| | | { |
| | | IReadOnlyCollection<string> jobGroupNames = await _scheduler.GetJobGroupNames(); |
| | | |
| | | await _scheduler.PauseAll(); |
| | | |
| | | // 调度器已停止,直接返回提示(不再对已 shutdown 的 scheduler 调用 PauseAll) |
| | | result = WebResponseContent.Instance.Error(QuartzJobInfoMessage.JobHasStop); |
| | | return result; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | if (_scheduler.IsShutdown && _scheduler.IsStarted) |
| | | if (_scheduler.IsShutdown || !_scheduler.IsStarted) |
| | | { |
| | | // 从Factory中获取Scheduler实例 |
| | | NameValueCollection collection = new NameValueCollection |