- 浏览: 782005 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (386)
- Linux (36)
- Tomcat (6)
- windows (8)
- Apache (10)
- Java (25)
- jquery (7)
- Jquery 插件 (3)
- Oracle (5)
- Oracle SQL (68)
- Spring (15)
- 开发工具 (6)
- Struts (20)
- js (14)
- Project Code (2)
- Project Code Tomcat (1)
- libset (1)
- JSP (8)
- arithmetic (2)
- 浏览器 (1)
- extjs (3)
- 学习网站 (5)
- 生活情感 (0)
- 电话号码算法 (3)
- 快捷键 (1)
- 转载 (1)
- Dos命令 (2)
- services (1)
- Resources (1)
- 行业积累 (3)
- 项目积累 (3)
- Web (3)
- 文档 (1)
- JavaEE (2)
- JSF (3)
- http (3)
- JS窗口 (1)
- Html (4)
- Flex (1)
- 资讯 (2)
- 项目规范 (1)
- Struts s:property textarea中默认值用 (1)
- Quartz 2.0.2 (12)
- 1天有多少毫秒 (1)
- 专题 (1)
- intellij idea 10 CD-KEY (1)
- restlet (4)
- Mail (1)
- Excel (3)
- Menu (1)
- Big Data技术综述 (1)
- Quart 1 (1)
- nosql (1)
- linux远程 (1)
- jdk (5)
- wind7 (1)
- 虚拟人 (0)
- 虚拟机 (1)
- 终端 (1)
- Ubuntu (16)
- Myeclipse (2)
- Wmware (1)
- eclipse (2)
- css (2)
- csv (1)
- 开源 (1)
- plsql (2)
- cassandra (4)
- maven (1)
- hadoop (2)
- mysql (1)
- spring security (1)
- tools (1)
- jdbc (2)
- exception (2)
- 硬盘数据备份 (1)
- dwr (1)
- svn (1)
- PowerDesigner15使用时的十五个问题 (1)
- tomcat 项目发部路径 (1)
- js 暂停执行 (1)
- jquery jqgrid 格式化数据显示 (1)
- js 代码模板 (1)
- strutss2 直接跳转到jsp页面 (1)
- servlet (1)
- jdbc spring (1)
- js学习网站 (1)
- 自学考试 (2)
- hibernate (2)
- eos (1)
- c (4)
- 黑马 (2)
- 大数据 (2)
- 实战云大数据案例分享 (0)
- Spark (2)
- Flink (1)
最新评论
-
coosummer:
推荐使用http://buttoncssgenerator.c ...
jquery button 漂亮 -
thinktothings:
Array_06 写道你好,我是一名刚毕业学生,我以后就是做J ...
如何转型架构师 -
thinktothings:
软考,考有职业资格证,有系统的知识体系学习
如何转型架构师 -
Array_06:
你好,我是一名刚毕业学生,我以后就是做Java的架构师,那请问 ...
如何转型架构师 -
beykery:
你这也太复杂了。。。。jsf2不应该是这样的。。。。
JSF2.0的一个简单Demo
Quartz Enterprise Job Scheduler Tutorial
Lesson 7: TriggerListeners and JobListeners
Listeners are objects that you create to perform actions based on events occurring within the scheduler. As you can probably guess, TriggerListeners receive events related to triggers, and JobListeners receive events related to jobs.
Trigger-related events include: trigger firings, trigger mis-firings (discussed in the "Triggers" section of this document), and trigger completions (the jobs fired off by the trigger is finished).
The org.quartz.TriggerListener Interface
public interface TriggerListener { public String getName(); public void triggerFired(Trigger trigger, JobExecutionContext context); public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context); public void triggerMisfired(Trigger trigger); public void triggerComplete(Trigger trigger, JobExecutionContext context, int triggerInstructionCode); }
Job-related events include: a notification that the job is about to be executed, and a notification when the job has completed execution.
The org.quartz.JobListener Interface
public interface JobListener { public String getName(); public void jobToBeExecuted(JobExecutionContext context); public void jobExecutionVetoed(JobExecutionContext context); public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException); }
Using Your Own Listeners
To create a listener, simply create an object that implements the org.quartz.TriggerListener and/or org.quartz.JobListener interface. Listeners are then registered with the scheduler during run time, and must be given a name (or rather, they must advertise their own name via their getName() method).
For your convenience, tather than implementing those interfaces, your class could also extend the class JobListenerSupport or TriggerListenerSupport and simply override the events you're interested in.
Listeners are registered with the scheduler's ListenerManager along with a Matcher that describes which Jobs/Triggers the listener wants to receive events for.
Adding a JobListener that is interested in a particular job:
scheduler.getListenerManager().addJobListener(myJobListener, KeyMatcher.keyEquals(new JobKey("myJobName", "myJobGroup")));
You may want to use static imports for the matcher and key classes, which will make your defining the matchers cleaner:
import static org.quartz.JobKey.*; import static org.quartz.impl.matchers.KeyMatcher.*; import static org.quartz.impl.matchers.GroupMatcher.*; import static org.quartz.impl.matchers.AndMatcher.*; import static org.quartz.impl.matchers.OrMatcher.*; import static org.quartz.impl.matchers.EverythingMatcher.*; ...etc.
Which turns the above example into this:
scheduler.getListenerManager().addJobListener(myJobListener, keyEquals(jobKey("myJobName", "myJobGroup")));
Adding a JobListener that is interested in all jobs of a particular group:
scheduler.getListenerManager().addJobListener(myJobListener, groupEquals("myJobGroup"));
Adding a JobListener that is interested in all jobs of two particular groups:
scheduler.getListenerManager().addJobListener(myJobListener, or(groupEquals("myJobGroup"), groupEquals("yourGroup")));
Adding a JobListener that is interested in all jobs:
scheduler.getListenerManager().addJobListener(myJobListener, allJobs());
...Registering TriggerListeners works in just the same way.
Listeners are not used by most users of Quartz, but are handy when application requirements create the need for the notification of events, without the Job itself having to explicitly notify the application.
- TriggerListenersandJobListeners.zip (862.8 KB)
- 下载次数: 4
发表评论
-
quartz 执行时间配置
2011-09-26 10:23 2520CronTrigger Tutorial Intro ... -
1天有多少毫秒
2011-07-28 14:43 18671、 --1天有多少毫秒 1天=86400000 ... -
Lesson 6: CronTrigger
2011-07-27 14:28 1289Quartz Enterprise Job Scheduler ... -
Lesson 5: SimpleTrigger
2011-07-27 14:22 1230Quartz Enterprise Job Scheduler ... -
Lesson 4: More About Triggers
2011-07-27 14:14 1105Quartz Enterprise Job Scheduler ... -
Lesson 3: More About Jobs and Job Details
2011-07-27 11:58 1373Quartz Enterprise Job Scheduler ... -
Lesson 2: The Quartz API, and Introduction to Jobs And Triggers
2011-07-27 11:34 1302Quartz Enterprise Job Scheduler ... -
Lesson 1: Using Quartz
2011-07-27 11:22 1096Quartz Enterprise Job Scheduler ... -
Examples Overview
2011-07-27 10:24 1029Examples Overview Welcome to t ... -
CronTrigger Tutorial
2011-07-27 10:04 1102http://www.quartz-scheduler.o ... -
quartz-2.0.2-examples
2011-07-27 07:58 1496Cron Triggers Expression ...
相关推荐
Lesson01:课程概述与如何学好FPGA
Lesson 7: Flats (3-3-5) - 32 - Lesson 8: Triangles - 36 - Lesson 9: Corrective Combinations - 39 - Lesson 10: The guideline of alternation - 43 - Lesson 11: Forecasting corrective waves - 46 - Lesson ...
画法几何课件:第七讲 相交问题 Lesson 7: Intersections.ppt
Lesson 7: Control RF Triggering Lesson 8: Review Sampling Parameters Lesson 9: Measure Intermodulation Distortion (RF to RF) Lesson 10: Measure Intermodulation Distortion (RF to RF) Lesson 11: ...
Lesson27:Danny+at+home课件.ppt
"Lesson 3: More About Jobs and Job Details"这个主题聚焦于如何更深入地理解任务(Jobs)以及它们的相关细节。在这个教程中,我们将探讨任务管理的核心概念、相关的工具,以及如何通过源码分析来了解其工作原理。 ...
本课"Lesson 4: More About Triggers"深入探讨了触发器的使用和实现细节。 在关系型数据库中,触发器主要用于实现数据完整性、业务规则的强制和审计跟踪等功能。当数据发生变化时,它们可以执行复杂的操作,这些...
1Unit1:SAP S/4HANA Finance-Introduction and ...75Lesson:Posting and Analyzing in Accounts Receivable 91 Unit 5:Understanding the Central Finance Option 92Lesson:Understanding the Central Finance Option
Lesson 1: Modeling a polygonal mesh from a reference image 导入两张图片,用多边形画头盔
Lesson 7: 《浏览器端测试:mocha,chai,phantomjs》 -- by @elrrrrrrr Lesson 8: 《测试用例:supertest》 Lesson 9: 《正则表达式》 Lesson 10: 《benchmark 怎么写》 Lesson 11: 《作用域与闭包:this,var...
Lesson 7: Working with and Formatting Text Lesson 8: Organizing your Illustrations with Layers Lesson 9: Working with Symbols Lesson 10: Using Effects and Transparency Lesson 11: Exporting and ...
7. Lesson7:视口和投影 - 学习如何调整视口大小和投影模式,以适应不同的显示需求。 8. Lesson8:动画 - 涉及如何通过帧间变化创建动态效果,比如旋转、平滑移动等。 9. Lesson9:键盘和鼠标输入 - 讲解如何处理...
Lesson7:文本数据处理 详细介绍了如何处理和准备文本数据,包括分词、词汇表构建以及张量化的技巧。还介绍了TextDataBunch,它是fastai库中用于处理文本数据的工具。 Lesson8:文本分类 这节课讲解了如何使用预...
这篇资料是关于Lesson16的课程,主题是“Happy or Sad”,主要教授孩子们理解和表达不同的情绪。课程通过对话和互动活动来帮助孩子们学习如何描述自己的情绪,并培养他们的情感认知。 首先,课程中出现了两个角色,...
- **Lesson7: Adding and Subtracting Decimals 加减小数** - **对齐小数点**: 确保所有数的小数点对齐后再进行加减运算。 - **Lesson8: Multiplying and Dividing Decimals 乘除小数** - **乘法**: 先忽略小数点...
* Lesson 4:Washroom and Library,介绍学校的基础设施,包括洗手间和图书馆。 * Lesson 5:Gym and Playground,介绍学校的体育设施,包括体育馆和游乐场。 * Lesson 6:Open and Close,教授学生打开和关闭的动作...
Lesson 7:水资源开发规划 水资源开发规划是指为满足人类对水资源的需求,制定的一系列计划和措施。水资源开发规划的目的是为了合理利用水资源,确保水资源的可持续发展。 Lesson 8:水库 水库是指人工建立...