Quartz.net官方开发指南 第八课:SchedulerListeners

SchedulerListeners同TriggerListeners及JobListeners非常相似,SchedulerListeners只接收与特定trigger 或job无关的Scheduler自身事件通知。

Scheduler相关的事件包括:增加job或者trigger,移除Job或者trigger, scheduler内部发生的错误,scheduler将被关闭的通知,以及其他。

Quartz.ISchedulerListener 接口

/// <summary>  
/// The interface to be implemented by classes that want to be informed of major  
/// <see cref="IScheduler" /> events.  
/// </summary>  
/// <seealso cref="IScheduler" />  
/// <seealso cref="IJobListener" />  
/// <seealso cref="ITriggerListener" />  
/// <author> James House</author>  
public interface ISchedulerListener  
{  
/// <summary>  
/// Called by the <see cref="IScheduler" /> when a <see cref="JobDetail" />  
/// is scheduled.  
/// </summary>  
void JobScheduled(Trigger trigger);  
/// <summary>  
/// Called by the <see cref="IScheduler" /> when a <see cref="JobDetail" />  
/// is unscheduled.  
/// </summary>  
void JobUnscheduled(string triggerName, string triggerGroup);  
/// <summary>  
/// Called by the <see cref="IScheduler" /> when a <see cref="Trigger" />  
/// has reached the condition in which it will never fire again.  
/// </summary>  
void TriggerFinalized(Trigger trigger);  
/// <summary>  
/// Called by the <see cref="IScheduler"/> when a <see cref="Trigger"/>  
/// or group of <see cref="Trigger"/>s has been paused.  
/// <p>  
/// If a group was paused, then the <see param="triggerName"/> parameter  
/// will be null.  
/// </p>  
/// </summary>  
/// <param name="triggerName">Name of the trigger.</param>  
/// <param name="triggerGroup">The trigger group.</param>  
void TriggersPaused(string triggerName, string triggerGroup);  
/// <summary>  
/// Called by the <see cref="IScheduler"/> when a <see cref="Trigger"/>  
/// or group of <see cref="Trigger"/>s has been un-paused.  
/// <p>  
/// If a group was resumed, then the <see param="triggerName"/> parameter  
/// will be null.  
/// </p>  
/// </summary>  
/// <param name="triggerName">Name of the trigger.</param>  
/// <param name="triggerGroup">The trigger group.</param>  
void TriggersResumed(string triggerName, string triggerGroup);  
/// <summary>  
/// Called by the <see cref="IScheduler"/> when a <see cref="JobDetail"/>  
/// or group of <see cref="JobDetail"/>s has been paused.  
/// <p>  
/// If a group was paused, then the <see param="jobName"/> parameter will be  
/// null. If all jobs were paused, then both parameters will be null.  
/// </p>  
/// </summary>  
/// <param name="jobName">Name of the job.</param>  
/// <param name="jobGroup">The job group.</param>  
void JobsPaused(string jobName, string jobGroup);  
/// <summary>  
/// Called by the <see cref="IScheduler" /> when a <see cref="JobDetail" />  
/// or group of <see cref="JobDetail" />s has been un-paused.  
/// <p>  
/// If a group was resumed, then the <param name="jobName" /> parameter will  
/// be null. If all jobs were paused, then both parameters will be null.  
/// </p>  
/// </summary>  
void JobsResumed(string jobName, string jobGroup);  
/// <summary>  
/// Called by the <see cref="IScheduler" /> when a serious error has  
/// occured within the scheduler - such as repeated failures in the <see cref="IJobStore" />,  
/// or the inability to instantiate a <see cref="IJob" /> instance when its  
/// <see cref="Trigger" /> has fired.  
/// <p>  
/// The <see cref="SchedulerException.ErrorCode" /> property of the given SchedulerException  
/// can be used to determine more specific information about the type of  
/// error that was encountered.  
/// </p>  
/// </summary>  
void SchedulerError(string msg, SchedulerException cause);  
/// <summary>  
/// Called by the <see cref="IScheduler" /> to inform the listener  
/// that it has Shutdown.  
/// </summary>  
void SchedulerShutdown();  
}  

除了不分“全局”或者“非全局”监听器外,SchedulerListeners创建及注册的方法同其他监听器类型十分相同。所有实现Quartz.ISchedulerListener接口的对象都是SchedulerListeners。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏androidBlog

ARouter 使用教程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gdutxiaoxu/article/de...

38210
来自专栏Hellovass 的博客

动态生成分享图片

本文描述了如何实现该需求的思路,代码可能不通用,但是该思路应该可以解决很多类似的需求…

49730
来自专栏向治洪

android断点下载

断点下载往往用在大文件的下载过程中,如传统的迅雷下载用的就是断点下载技术,说起来原理比较简单:对文件进行分片,并对分片的文件进行标记,然后分片下载,下载完成后对...

293100
来自专栏软件开发 -- 分享 互助 成长

WIFI环境下Android手机和电脑通信

前面已经写过一篇java实现最基础的socket网络通信,这篇和之前那篇大同小异,只是将客户端代码移植到手机中,然后获取本机IP的方法略有不同。 先讲一下本篇中...

40150
来自专栏郭霖

Android ListView异步加载图片乱序问题,原因分析及解决方案

在Android所有系统自带的控件当中,ListView这个控件算是用法比较复杂的了,关键是用法复杂也就算了,它还经常会出现一些稀奇古怪的问题,让人非常头疼。比...

421100
来自专栏Android知识点总结

[番外]理一理Android多文件上传那点事

19410
来自专栏非著名程序员

Retrofit初探和简单使用

? Retrofit简单介绍 Retrofit是Square提供的开源产品,为Android平台的应用提供一个类型安全的REST客户端。它是基于注解,提供 J...

21290
来自专栏向治洪

android orm持久层框架

android数据库开发   Android中内置了sqlite,但是常用的开发语言java是面向对象的,而数据库是关系型的,二者之间的转化每次都很麻烦(主...

19350
来自专栏wOw的Android小站

[Android][Framework] 从一个小问题了解STK加载内容的方式

这个界面从哪来的? 实际上,我们插入SIM卡,手机就会显示SimToolKit,打开就能看到一些和运营商相关的菜单。换了不同的卡菜单也会变。所以大概可以猜到,S...

27310
来自专栏一个会写诗的程序员的博客

《Kotin 极简教程》第13章 使用 Kotlin 和 Anko 的Android 开发

Anko (https://github.com/Kotlin/anko) 是一个用 Kotlin 写的Android DSL (Domain-Specifi...

31630

扫码关注云+社区

领取腾讯云代金券