public bool Start(HostControl hostControl) { try { _scheduler.ListenerManager.AddJobListener(new JobListener(), GroupMatcher <JobKey> .AnyGroup()); _scheduler.Start(); QuartzManager.ManagerScheduler(_scheduler); } catch (Exception e) { _log.Error($"Scheduler started failed: {e.Message}", e); } _log.Info("Scheduler started successfully"); return(true); }
/// <summary> /// 服务停止 /// </summary> public async Task StopAsync(CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return; } try { QuartzManager.SchedulerStopping(); await _scheduler.Shutdown(true); } catch (Exception e) { //_log.Error($"Scheduler stop failed: {e.Message}", e); } //_log.Info("Scheduler shutdown complete"); }
/// <summary> /// 服务启动 /// </summary> public async Task StartAsync(CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return; } try { _scheduler.ListenerManager.AddJobListener(new JobListener(), GroupMatcher <JobKey> .AnyGroup()); await _scheduler.Start(); await QuartzManager.ManagerScheduler(_scheduler); } catch (Exception e) { //_log.Error($"Scheduler started failed: {e.Message}", e); } //_log.Info("Scheduler started successfully"); }
public Task Execute(IJobExecutionContext context) { Version Ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; _logger.InfoFormat("SystemJob Execute begin Ver." + Ver.ToString()); try { QuartzManager.ManagerScheduler(context.Scheduler); _logger.InfoFormat("SystemJob Executing ..."); } catch (Exception ex) { JobExecutionException e2 = new JobExecutionException(ex) { RefireImmediately = true }; } finally { _logger.InfoFormat("SystemJob Execute end. "); } return(Task.CompletedTask); }
public async Task Execute(IJobExecutionContext context) { Version Ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; //_log.Info("SystemJob Execute begin Ver." + Ver.ToString()); try { await QuartzManager.ManagerScheduler(context.Scheduler); //_log.Info("SystemJob Executing ..."); } catch (Exception ex) { JobExecutionException e2 = new JobExecutionException(ex) { RefireImmediately = true }; } finally { //_log.Info("SystemJob Execute end. "); } }