- 浏览: 768096 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (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 2477CronTrigger Tutorial Intro ... -
1天有多少毫秒
2011-07-28 14:43 17961、 --1天有多少毫秒 1天=86400000 ... -
Lesson 6: CronTrigger
2011-07-27 14:28 1250Quartz Enterprise Job Scheduler ... -
Lesson 5: SimpleTrigger
2011-07-27 14:22 1177Quartz Enterprise Job Scheduler ... -
Lesson 4: More About Triggers
2011-07-27 14:14 1068Quartz Enterprise Job Scheduler ... -
Lesson 3: More About Jobs and Job Details
2011-07-27 11:58 1327Quartz Enterprise Job Scheduler ... -
Lesson 2: The Quartz API, and Introduction to Jobs And Triggers
2011-07-27 11:34 1279Quartz Enterprise Job Scheduler ... -
Lesson 1: Using Quartz
2011-07-27 11:22 1052Quartz Enterprise Job Scheduler ... -
Examples Overview
2011-07-27 10:24 1002Examples Overview Welcome to t ... -
CronTrigger Tutorial
2011-07-27 10:04 1071http://www.quartz-scheduler.o ... -
quartz-2.0.2-examples
2011-07-27 07:58 1463Cron 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: Using RichTextBoxes Lesson 8: Using Standard Dialogs Lesson 9: Creating and Displaying New Forms Lesson 10: Building Custom Dialogs Section II: Variables and Calculations Lesson 11: Using ...
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: ...
Lesson7: 对话框编程 19 Lesson9: 定制应用程序的外观 26 Lesson10: 绘图控制 29 Lesson11 图形的保存和重绘 30 Lesson12 文件操作 31 Lesson 13: 文档串行化 35 Lesson14 网络编程 36 Lesson 15 多线程 44 Lesson ...
Lesson16:HappyorSad.pptx
Lesson27:Danny+at+home课件.ppt
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...
新概念英语词汇随身听第一册Lesson48:我们把它吃了吧.pdf
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 ...
NULL 博文链接:https://thinktothings.iteye.com/blog/1133867
Lesson 1: Concepts – Locks and Lock Manager Lesson 2: Concepts – Batch and Transaction Lesson 3: Concepts – Locks and Applications Lesson 4: Information Collection and Analysis Lesson 5: ...
NULL 博文链接:https://thinktothings.iteye.com/blog/1133761
NULL 博文链接:https://thinktothings.iteye.com/blog/1133974